PumpkinBrush
Classes | Functions | Variables
main.cpp File Reference

Entry point into the program. More...

#include <SFML/Graphics.hpp>
#include <SFML/Graphics/Image.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Network.hpp>
#include <iostream>
#include <ostream>
#include <string>
#include <string.h>
#include "time.h"
#include "App.hpp"
#include "Command.hpp"
#include "Draw.hpp"
#include "Erase.hpp"
#include "Brush.hpp"
#include "Pen.hpp"
#include "Clear.hpp"
#include <SFML/OpenGL.hpp>
Include dependency graph for main.cpp:

Classes

struct  metaData
 This struct represents meta data that will be sent to and from the server. It will be used to pack into the SFML API's Packet class and also to unpack that same data. More...
 

Functions

void remoteDraw (App &app, sf::Uint32 xToPass, sf::Uint32 yToPass, sf::Uint32 colorOfModification, sf::Uint32 sizeOfModification, sf::Uint32 brushTypeOfModification)
 The remoteDraw function allows a Client to draw locally the received draw commands from the Server representing draw commands sent from a different client. More...
 
void packetReceiver (App &app)
 The packetReceiver function uses the socket with in App close to receive information from the server then controls the work flow based on the unpacked command received from the server. More...
 
void initialization (void)
 The initialization function simply verifies the Application has started by printing out a statement to the command line. More...
 
void update (App &app)
 The update function controls key and mouse events on the painting canvas of the application. Then updates the canvas accordingly. This function also is where the packetReceiver function is called allowing inputs from the Server to be handled. More...
 
void draw (App &app)
 The draw call, this is how the canvas refreshes. More...
 
int main (int argc, char *argv[])
 The entry point into our program. More...
 

Variables

sf::TcpSocket clientSocket
 
sf::Socket::Status status
 
sf::Packet packet
 

Detailed Description

Entry point into the program.

Author
Mike, Japher Su, Jugal Joshi, Hao Zheng, and Andrew Seedholm
Date
2020-07-12

Function Documentation

◆ draw()

void draw ( App app)

The draw call, this is how the canvas refreshes.

◆ initialization()

void initialization ( void  )

The initialization function simply verifies the Application has started by printing out a statement to the command line.

◆ main()

int main ( int  argc,
char *  argv[] 
)

The entry point into our program.

◆ packetReceiver()

void packetReceiver ( App app)

The packetReceiver function uses the socket with in App close to receive information from the server then controls the work flow based on the unpacked command received from the server.

Parameters
appan App object that allows us to receive packets from the Server as well as execute various commands based on the received information.

◆ remoteDraw()

void remoteDraw ( App app,
sf::Uint32  xToPass,
sf::Uint32  yToPass,
sf::Uint32  colorOfModification,
sf::Uint32  sizeOfModification,
sf::Uint32  brushTypeOfModification 
)

The remoteDraw function allows a Client to draw locally the received draw commands from the Server representing draw commands sent from a different client.

Parameters
appan App object that allows us to execute draw commands outside of the update loop.
xToPassa sf::Uint32 variable representing the x coordinate for where the remote draw command took place.
yToPassa sf::Uint32 variable representing the y coordinate for where the remote draw command took place.
colorOfModificationa sf::Uint32 variable representing the color drawn where the remote draw command took place.
sizeOfModificationa sf::Uint32 variable representing the size of the brush(or pen) where the remote draw command took place (small, medium, or large).
brushTypeOfModificationa sf::Uint32 variable representing the brush type (brush or pen) for where the remote draw command took place.

◆ update()

void update ( App app)

The update function controls key and mouse events on the painting canvas of the application. Then updates the canvas accordingly. This function also is where the packetReceiver function is called allowing inputs from the Server to be handled.

Parameters
appan App object that allows us to access and manipulate the canvas.

Variable Documentation

◆ clientSocket

sf::TcpSocket clientSocket

◆ packet

sf::Packet packet

◆ status

sf::Socket::Status status