R-Type
Public Member Functions | List of all members
RType::Server::RTypeServer Class Reference

#include <RTypeServer.hpp>

Public Member Functions

 RTypeServer (unsigned short port=8080)
 
 ~RTypeServer ()
 
void gameLoop ()
 GameLoop to run the game. More...
 
void handleEvent ()
 Function that will handle every event from the udp server. More...
 
void handleConnexion (struct RType::Event event)
 Function that will handle the connexion of a client. More...
 
void handleMove (struct RType::Protocol::MoveData moveInfo)
 Function that will handle the move from a client. More...
 
void handleDestroy (struct RType::Event event)
 Function that will handle the disconnexion of a client. More...
 
void startNetwork (bool &isRunning)
 Function that will start the Network in a thread. More...
 
void handleShoot (struct RType::Protocol::ShootData shootInfo)
 
void spawnMob (std::chrono::steady_clock::time_point &now)
 
void broadcastInformation ()
 
void handlingDamage (std::size_t entityId, std::size_t i, SparseArray< GameEngine::CollisionComponent > &collisions)
 
void destroyEntityCallback (const std::size_t &entityId, SparseArray< GameEngine::CollisionComponent > &collisions, SparseArray< GameEngine::TransformComponent > &transforms)
 
void playerCollisionCallback (const std::size_t &entityId, SparseArray< GameEngine::CollisionComponent > &collisions, SparseArray< GameEngine::TransformComponent > &transforms)
 
void playerDamageCallback (const std::size_t &entityId, SparseArray< GameEngine::CollisionComponent > &collisions, SparseArray< GameEngine::TransformComponent > &transforms)
 
void broadcastTransformComponent ()
 
void sendTransformComponent (uint16_t id, GameEngine::Vector2< float > position, GameEngine::Vector2< float > velocity, asio::ip::udp::endpoint &endpoint)
 
void broadcastCollisionComponent ()
 
void sendCollisionComponent (uint16_t id, GameEngine::Rectf collider, std::size_t layer, asio::ip::udp::endpoint &endpoint)
 
void broadcastTextureComponent ()
 
void sendTextureComponent (uint16_t id, std::size_t index, GameEngine::TextureComponent &texture, asio::ip::udp::endpoint &endpoint)
 
void handleTextureResponse (struct RType::Event event)
 
void handleCollisionResponse (struct RType::Event event)
 
void handleInput (struct RType::Event event)
 
componentList setEntitiesComponent ()
 
void broadcastEntityInformation (const GameEngine::Entity &entity)
 
void checkSendingTexture (std::vector< bool > listDisplayTexture, const GameEngine::Entity &entity, asio::ip::udp::endpoint &endpoint)
 
void setGameEngineComponent ()
 
void setPrefab ()
 
void setGameEngineSystem ()
 
void setGameEngine ()
 
void setupGame ()
 
void handlingTimers ()
 
void handlingEndGame ()
 
void setTimers ()
 
std::size_t findEntity (const std::size_t &networkId)
 
bool searchEntity (const std::size_t &networkId)
 
void sendControllableInformation (GameEngine::Entity &entity, unsigned short port)
 
void checkCollisionComponent (GameEngine::CollisionComponent &collision, std::size_t i)
 
void handleShootType (const std::string &typeShootString, struct RType::Protocol::ShootData shootData, RType::TextureType typeShoot)
 
void updateComponentInformation (GameEngine::Entity &entity, RType::TextureType entityType)
 
void handlingLifePoint (std::size_t entityId, std::size_t id)
 
GameEngine::Vector2< float > handlingMovement (GameEngine::TransformComponent &transform, struct RType::Protocol::InputData inputInfo)
 
void handleDestroyCallback (std::size_t &id)
 
void setDestroyCallback ()
 
void setGameEngineCallback ()
 
void spawnEntityMob (const std::string &mob, RType::TextureType mobType)
 
void handleImmunity (std::chrono::steady_clock::time_point &now)
 
void sendScore (unsigned short port)
 
void setImmunity (std::chrono::duration< float > timerInvincibility, std::pair< const uint16_t, std::pair< bool, std::chrono::steady_clock::time_point >> playerTimer, std::chrono::steady_clock::time_point &now)
 
void sendDestroyInfo (struct RType::Protocol::EntityIdData entity)
 
void saveHighScore ()
 

Constructor & Destructor Documentation

◆ RTypeServer()

RType::Server::RTypeServer::RTypeServer ( unsigned short  port = 8080)

◆ ~RTypeServer()

RType::Server::RTypeServer::~RTypeServer ( )

Member Function Documentation

◆ broadcastCollisionComponent()

void RType::Server::RTypeServer::broadcastCollisionComponent ( )

◆ broadcastEntityInformation()

void RType::Server::RTypeServer::broadcastEntityInformation ( const GameEngine::Entity entity)

◆ broadcastInformation()

void RType::Server::RTypeServer::broadcastInformation ( )

◆ broadcastTextureComponent()

void RType::Server::RTypeServer::broadcastTextureComponent ( )

◆ broadcastTransformComponent()

void RType::Server::RTypeServer::broadcastTransformComponent ( )

◆ checkCollisionComponent()

void RType::Server::RTypeServer::checkCollisionComponent ( GameEngine::CollisionComponent collision,
std::size_t  i 
)

◆ checkSendingTexture()

void RType::Server::RTypeServer::checkSendingTexture ( std::vector< bool >  listDisplayTexture,
const GameEngine::Entity entity,
asio::ip::udp::endpoint &  endpoint 
)

◆ destroyEntityCallback()

void RType::Server::RTypeServer::destroyEntityCallback ( const std::size_t &  entityId,
SparseArray< GameEngine::CollisionComponent > &  collisions,
SparseArray< GameEngine::TransformComponent > &  transforms 
)

◆ findEntity()

std::size_t RType::Server::RTypeServer::findEntity ( const std::size_t &  networkId)

◆ gameLoop()

void RType::Server::RTypeServer::gameLoop ( )

GameLoop to run the game.

◆ handleCollisionResponse()

void RType::Server::RTypeServer::handleCollisionResponse ( struct RType::Event  event)

◆ handleConnexion()

void RType::Server::RTypeServer::handleConnexion ( struct RType::Event  event)

Function that will handle the connexion of a client.

◆ handleDestroy()

void RType::Server::RTypeServer::handleDestroy ( struct RType::Event  event)

Function that will handle the disconnexion of a client.

Parameters
eventstruct that contain the data (information about the client)

◆ handleDestroyCallback()

void RType::Server::RTypeServer::handleDestroyCallback ( std::size_t &  id)

◆ handleEvent()

void RType::Server::RTypeServer::handleEvent ( )

Function that will handle every event from the udp server.

◆ handleImmunity()

void RType::Server::RTypeServer::handleImmunity ( std::chrono::steady_clock::time_point &  now)

◆ handleInput()

void RType::Server::RTypeServer::handleInput ( struct RType::Event  event)

◆ handleMove()

void RType::Server::RTypeServer::handleMove ( struct RType::Protocol::MoveData  moveInfo)

Function that will handle the move from a client.

Parameters
eventstruct that contain the data (Information about the move)

◆ handleShoot()

void RType::Server::RTypeServer::handleShoot ( struct RType::Protocol::ShootData  shootInfo)

◆ handleShootType()

void RType::Server::RTypeServer::handleShootType ( const std::string &  typeShootString,
struct RType::Protocol::ShootData  shootData,
RType::TextureType  typeShoot 
)

◆ handleTextureResponse()

void RType::Server::RTypeServer::handleTextureResponse ( struct RType::Event  event)

◆ handlingDamage()

void RType::Server::RTypeServer::handlingDamage ( std::size_t  entityId,
std::size_t  i,
SparseArray< GameEngine::CollisionComponent > &  collisions 
)

◆ handlingEndGame()

void RType::Server::RTypeServer::handlingEndGame ( )

◆ handlingLifePoint()

void RType::Server::RTypeServer::handlingLifePoint ( std::size_t  entityId,
std::size_t  id 
)

◆ handlingMovement()

GameEngine::Vector2< float > RType::Server::RTypeServer::handlingMovement ( GameEngine::TransformComponent transform,
struct RType::Protocol::InputData  inputInfo 
)

◆ handlingTimers()

void RType::Server::RTypeServer::handlingTimers ( )

◆ playerCollisionCallback()

void RType::Server::RTypeServer::playerCollisionCallback ( const std::size_t &  entityId,
SparseArray< GameEngine::CollisionComponent > &  collisions,
SparseArray< GameEngine::TransformComponent > &  transforms 
)

◆ playerDamageCallback()

void RType::Server::RTypeServer::playerDamageCallback ( const std::size_t &  entityId,
SparseArray< GameEngine::CollisionComponent > &  collisions,
SparseArray< GameEngine::TransformComponent > &  transforms 
)

◆ saveHighScore()

void RType::Server::RTypeServer::saveHighScore ( )

◆ searchEntity()

bool RType::Server::RTypeServer::searchEntity ( const std::size_t &  networkId)

◆ sendCollisionComponent()

void RType::Server::RTypeServer::sendCollisionComponent ( uint16_t  id,
GameEngine::Rectf  collider,
std::size_t  layer,
asio::ip::udp::endpoint &  endpoint 
)

◆ sendControllableInformation()

void RType::Server::RTypeServer::sendControllableInformation ( GameEngine::Entity entity,
unsigned short  port 
)

◆ sendDestroyInfo()

void RType::Server::RTypeServer::sendDestroyInfo ( struct RType::Protocol::EntityIdData  entity)

◆ sendScore()

void RType::Server::RTypeServer::sendScore ( unsigned short  port)

◆ sendTextureComponent()

void RType::Server::RTypeServer::sendTextureComponent ( uint16_t  id,
std::size_t  index,
GameEngine::TextureComponent texture,
asio::ip::udp::endpoint &  endpoint 
)

◆ sendTransformComponent()

void RType::Server::RTypeServer::sendTransformComponent ( uint16_t  id,
GameEngine::Vector2< float >  position,
GameEngine::Vector2< float >  velocity,
asio::ip::udp::endpoint &  endpoint 
)

◆ setDestroyCallback()

void RType::Server::RTypeServer::setDestroyCallback ( )

◆ setEntitiesComponent()

componentList RType::Server::RTypeServer::setEntitiesComponent ( )

◆ setGameEngine()

void RType::Server::RTypeServer::setGameEngine ( )

◆ setGameEngineCallback()

void RType::Server::RTypeServer::setGameEngineCallback ( )

◆ setGameEngineComponent()

void RType::Server::RTypeServer::setGameEngineComponent ( )

◆ setGameEngineSystem()

void RType::Server::RTypeServer::setGameEngineSystem ( )

◆ setImmunity()

void RType::Server::RTypeServer::setImmunity ( std::chrono::duration< float >  timerInvincibility,
std::pair< const uint16_t, std::pair< bool, std::chrono::steady_clock::time_point >>  playerTimer,
std::chrono::steady_clock::time_point &  now 
)

◆ setPrefab()

void RType::Server::RTypeServer::setPrefab ( )

◆ setTimers()

void RType::Server::RTypeServer::setTimers ( )

◆ setupGame()

void RType::Server::RTypeServer::setupGame ( )

◆ spawnEntityMob()

void RType::Server::RTypeServer::spawnEntityMob ( const std::string &  mob,
RType::TextureType  mobType 
)

◆ spawnMob()

void RType::Server::RTypeServer::spawnMob ( std::chrono::steady_clock::time_point &  now)

◆ startNetwork()

void RType::Server::RTypeServer::startNetwork ( bool &  isRunning)

Function that will start the Network in a thread.

Parameters
isRunningboolean to know if the server is down

◆ updateComponentInformation()

void RType::Server::RTypeServer::updateComponentInformation ( GameEngine::Entity entity,
RType::TextureType  entityType 
)

The documentation for this class was generated from the following files: