PumpkinBrush
|
#include <App.hpp>
Public Types | |
enum | commandEnum { DRAW, CLEAR, ERASE, UNDO, REDO } |
Public Member Functions | |
App () | |
The constructor of the App class that initializes certain crucial values for the application. More... | |
App (sf::IpAddress ipAddress, int port) | |
The second constructor of the App class that initializes certain crucial values for the application but here it takes in two arguments for networking purposes. More... | |
GeneralBrush & | getBrush () |
Return the current brush instance of the App. More... | |
BrushFactory | getBrushFactory () |
Return the brush factory of App. More... | |
void | setBrush (GeneralBrush *brush) |
Set the current brush. More... | |
void | addCommand (Command *c) |
The addCommand function servers two purpose, first is adding the command to the redo stack and the second is executing the command so it can be reflected on the canvas. More... | |
void | executeCommand (Command *c) |
The execute Command function helps execute the command to generate pixel upon input from the user, the method is being called from AddCommand() function. More... | |
void | undoCommand (bool sendMessage) |
The undoCommand function unodoes the the pixel in reverse chronological order from a stack recursively. More... | |
void | redoCommand (bool sendMessage) |
The redo commands redo an undo command until if there is an input in between. More... | |
void | undoCommandNetwork () |
The undoCommand function unodoes the the pixel in reverse chronological order for the network i.e so the clients connected get the pixels created and erased on canvas. More... | |
void | redoCommandNetwork () |
The redo commands redo an undo command until if there is an input in between for the network i.e so the clients connected get the pixels created and erased on canvas. More... | |
sf::Image & | getImage () |
Return a reference to our m_image, so that we do not have to publicly expose it. More... | |
void | setImage (sf::Image *newImage) |
Sets the image passed in from the parameter for the App class. More... | |
sf::Texture & | getTexture () |
Return a reference to our m_Texture so that we do not have to publicly expose it. More... | |
sf::RenderWindow & | getWindow () |
Return a reference to our m_window so that we do not have to publicly expose it. More... | |
std::stack< Command * > | getUndoStack () |
returns the current undo stack where all the commands to be undone are stored More... | |
std::stack< Command * > | getRedoStack () |
returns the current redo stack where all the commands to be redone are stored More... | |
void | destroy () |
destroy we manually call at end of our program. More... | |
void | init (void(*initFunction)(void)) |
Initializes the App and sets up the main rendering window(i.e. our canvas.) More... | |
void | updateCallback (void(*updateFunction)(App &app)) |
Set a callback function which will be called each iteration of the main loop before drawing. More... | |
void | drawCallback (void(*drawFunction)(App &app)) |
Set a callback function which will be called each iteration of the main loop after update. More... | |
void | loop (App &app) |
The main loop function which handles initialization and will be executed until the main window is closed. Within the loop function the update and draw callback functions will be called. More... | |
void | setBackgroundColor (sf::Color *colorPassed) |
Set a reference to m_backgroundColor. More... | |
sf::Color & | getBackgroundColor () |
Return a reference to our m_backgroundColor so that we do not have to publicly expose it. More... | |
Public Attributes | |
sf::TcpSocket | clientSocketInApp |
sf::Socket::Status | statusInApp |
sf::Packet | packetInApp |
unsigned int | pmouseX |
unsigned int | pmouseY |
unsigned int | mouseX |
unsigned int | mouseY |
int | commandFlag = 1 |
commandEnum | m_prevCommand |
bool | onErase = false |
sf::RenderWindow * | m_window |
Gui * | m_gui |
enum App::commandEnum |
App::App | ( | ) |
The constructor of the App class that initializes certain crucial values for the application.
App::App | ( | sf::IpAddress | ipAddress, |
int | port | ||
) |
The second constructor of the App class that initializes certain crucial values for the application but here it takes in two arguments for networking purposes.
ipAddress | the IP Address of the server to be passed for the client to connect with the server |
port | number of the server running |
void App::addCommand | ( | Command * | c | ) |
The addCommand function servers two purpose, first is adding the command to the redo stack and the second is executing the command so it can be reflected on the canvas.
c | a command object that is being passed, it can be draw, erase or clear |
void App::destroy | ( | ) |
destroy we manually call at end of our program.
void App::drawCallback | ( | void(*)(App &app) | drawFunction | ) |
Set a callback function which will be called each iteration of the main loop after update.
drawFunction | is a function that takes in App object as an argument so it can be executed later in the application |
void App::executeCommand | ( | Command * | c | ) |
The execute Command function helps execute the command to generate pixel upon input from the user, the method is being called from AddCommand() function.
c | a command object that is being passed, it can be draw, erase or clear |
sf::Color & App::getBackgroundColor | ( | ) |
Return a reference to our m_backgroundColor so that we do not have to publicly expose it.
GeneralBrush & App::getBrush | ( | ) |
BrushFactory App::getBrushFactory | ( | ) |
sf::Image & App::getImage | ( | ) |
Return a reference to our m_image, so that we do not have to publicly expose it.
std::stack< Command * > App::getRedoStack | ( | ) |
returns the current redo stack where all the commands to be redone are stored
sf::Texture & App::getTexture | ( | ) |
Return a reference to our m_Texture so that we do not have to publicly expose it.
std::stack< Command * > App::getUndoStack | ( | ) |
returns the current undo stack where all the commands to be undone are stored
sf::RenderWindow & App::getWindow | ( | ) |
Return a reference to our m_window so that we do not have to publicly expose it.
void App::init | ( | void(*)(void) | initFunction | ) |
Initializes the App and sets up the main rendering window(i.e. our canvas.)
initFunction | a pointer to a function that is executed later when the program is initiated |
void App::loop | ( | App & | app | ) |
The main loop function which handles initialization and will be executed until the main window is closed. Within the loop function the update and draw callback functions will be called.
app | the instance of app class passed so the it can be used to execute various functions |
void App::redoCommand | ( | bool | sendMessage | ) |
The redo commands redo an undo command until if there is an input in between.
sendMessage | a bool value to check if the message has been sent over the network for conditional logic |
void App::redoCommandNetwork | ( | ) |
The redo commands redo an undo command until if there is an input in between for the network i.e so the clients connected get the pixels created and erased on canvas.
void App::setBackgroundColor | ( | sf::Color * | colorPassed | ) |
Set a reference to m_backgroundColor.
colorPassed | the color of the background |
void App::setBrush | ( | GeneralBrush * | brush | ) |
Set the current brush.
brush | the brush to be set is passed as an argument for the App class |
void App::setImage | ( | sf::Image * | newImage | ) |
void App::undoCommand | ( | bool | sendMessage | ) |
The undoCommand function unodoes the the pixel in reverse chronological order from a stack recursively.
sendMessage | a bool value to check if the message has been sent over the network for conditional logic |
void App::undoCommandNetwork | ( | ) |
The undoCommand function unodoes the the pixel in reverse chronological order for the network i.e so the clients connected get the pixels created and erased on canvas.
void App::updateCallback | ( | void(*)(App &app) | updateFunction | ) |
Set a callback function which will be called each iteration of the main loop before drawing.
updateFuntion | is a function that takes in App object as an argument so it can be executed later in the application |
sf::TcpSocket App::clientSocketInApp |
int App::commandFlag = 1 |
Gui* App::m_gui |
commandEnum App::m_prevCommand |
sf::RenderWindow* App::m_window |
unsigned int App::mouseX |
unsigned int App::mouseY |
bool App::onErase = false |
sf::Packet App::packetInApp |
unsigned int App::pmouseX |
unsigned int App::pmouseY |
sf::Socket::Status App::statusInApp |