Go to the documentation of this file.
13 #include <SFML/Graphics.hpp>
14 #include <SFML/Graphics/Image.hpp>
15 #include <SFML/Graphics/Texture.hpp>
16 #include <SFML/Graphics/Sprite.hpp>
18 #include <SFML/Network.hpp>
41 std::stack<Command*> m_redo;
43 std::stack<Command*> m_undo;
50 sf::Texture* m_texture;
57 sf::Color* m_backgroundColor;
65 void (*m_initFunc)(void);
66 void (*m_updateFunc)(
App&);
67 void (*m_drawFunc)(
App&);
91 App(sf::IpAddress ipAddress,
int port);
115 void init(
void (*initFunction)(
void));
127 //TODO: Write comments for the methods
void destroy()
destroy we manually call at end of our program.
Definition: App.cpp:262
GeneralBrush & getBrush()
Return the current brush instance of the App.
Definition: App.cpp:225
unsigned int pmouseY
Definition: App.hpp:80
sf::Socket::Status statusInApp
Definition: App.hpp:73
@ UNDO
Definition: App.hpp:84
Gui * m_gui
Definition: App.hpp:88
@ DRAW
Definition: App.hpp:84
sf::TcpSocket clientSocketInApp
Definition: App.hpp:72
int commandFlag
Definition: App.hpp:83
Definition: Command.hpp:18
bool onErase
Definition: App.hpp:86
@ CLEAR
Definition: App.hpp:84
@ REDO
Definition: App.hpp:84
sf::RenderWindow & getWindow()
Return a reference to our m_window so that we do not have to publicly expose it.
Definition: App.cpp:208
void undoCommand(bool sendMessage)
The undoCommand function unodoes the the pixel in reverse chronological order from a stack recursivel...
Definition: App.cpp:99
sf::Image & getImage()
Return a reference to our m_image, so that we do not have to publicly expose it.
Definition: App.cpp:186
App()
The constructor of the App class that initializes certain crucial values for the application.
Definition: App.cpp:41
@ ERASE
Definition: App.hpp:84
void redoCommand(bool sendMessage)
The redo commands redo an undo command until if there is an input in between.
Definition: App.cpp:147
unsigned int mouseX
Definition: App.hpp:80
std::stack< Command * > getUndoStack()
returns the current undo stack where all the commands to be undone are stored
Definition: App.cpp:238
void setBrush(GeneralBrush *brush)
Set the current brush.
Definition: App.cpp:232
std::stack< Command * > getRedoStack()
returns the current redo stack where all the commands to be redone are stored
Definition: App.cpp:245
void undoCommandNetwork()
The undoCommand function unodoes the the pixel in reverse chronological order for the network i....
Definition: App.cpp:129
void init(void(*initFunction)(void))
Initializes the App and sets up the main rendering window(i.e. our canvas.)
Definition: App.cpp:273
A GUI class that renders a gui window and operation widgets for the mini paint app.
commandEnum m_prevCommand
Definition: App.hpp:85
sf::RenderWindow * m_window
Definition: App.hpp:87
void redoCommandNetwork()
The redo commands redo an undo command until if there is an input in between for the network i....
Definition: App.cpp:170
GeneralBrush class which represent the brush instance when drawing on the canvas.
Definition: GeneralBrush.hpp:13
void drawCallback(void(*drawFunction)(App &app))
Set a callback function which will be called each iteration of the main loop after update.
Definition: App.cpp:309
unsigned int mouseY
Definition: App.hpp:80
unsigned int pmouseX
Definition: App.hpp:80
void setBackgroundColor(sf::Color *colorPassed)
Set a reference to m_backgroundColor.
Definition: App.cpp:361
Represents an actionable command by the user.
void addCommand(Command *c)
The addCommand function servers two purpose, first is adding the command to the redo stack and the se...
Definition: App.cpp:31
void setImage(sf::Image *newImage)
Sets the image passed in from the parameter for the App class.
Definition: App.cpp:192
void loop(App &app)
The main loop function which handles initialization and will be executed until the main window is clo...
Definition: App.cpp:319
Brush factory class which initialize brush instance.
Definition: BrushFactory.hpp:6
void updateCallback(void(*updateFunction)(App &app))
Set a callback function which will be called each iteration of the main loop before drawing.
Definition: App.cpp:301
void executeCommand(Command *c)
The execute Command function helps execute the command to generate pixel upon input from the user,...
Definition: App.cpp:89
sf::Packet packetInApp
Definition: App.hpp:74
sf::Texture & getTexture()
Return a reference to our m_Texture so that we do not have to publicly expose it.
Definition: App.cpp:200
sf::Color & getBackgroundColor()
Return a reference to our m_backgroundColor so that we do not have to publicly expose it.
Definition: App.cpp:253
commandEnum
Definition: App.hpp:84
BrushFactory getBrushFactory()
Return the brush factory of App.
Definition: App.cpp:217