My Project
Public Member Functions | List of all members
System::HitboxSystem Class Reference

The Hitbox System class, it handles everything related to collisions between entities. More...

#include <HitboxSystem.hpp>

Public Member Functions

 HitboxSystem ()
 Construct a new Hitbox System object.
 
bool CheckCollision (component::crect_t const &rec1, component::crect_t const &rec2, component::cposition_t const &pos1, component::cposition_t const &pos2)
 A method to check if a collision happened. More...
 
void operator() (Registry &registry, Sparse_array< component::cnetwork_queue_t > &network_queues, Sparse_array< component::ctype_t > &types, Sparse_array< component::cposition_t > &positions, Sparse_array< component::crect_t > &rects, Sparse_array< component::chealth_t > &health, Sparse_array< component::clobby_id_t > &lobbyId, Sparse_array< component::cscore_t > &score, Sparse_array< component::ctype_t > &type, Sparse_array< component::cowner_id_t > &ownerId)
 The main handler for the Hitbox System. More...
 
void doHealthCheck (Registry &registry, component::cnetwork_queue_t &netQueue, component::chealth_t &health1, component::chealth_t &health2, component::clobby_id_t &lobbyId, int i, int x, ENTITY_TYPE &entityType)
 A method to check if a collision happened between a player and a bullet. More...
 
void doScoreUpdate (component::cnetwork_queue_t &netQueue, component::clobby_id_t &lobbyId, Sparse_array< component::cscore_t > &score, Sparse_array< component::ctype_t > &type, Sparse_array< component::cowner_id_t > &ownerId, int x)
 A method to check if a collision happened between a player and a bonus. More...
 

Detailed Description

The Hitbox System class, it handles everything related to collisions between entities.

Member Function Documentation

◆ CheckCollision()

bool System::HitboxSystem::CheckCollision ( component::crect_t const &  rec1,
component::crect_t const &  rec2,
component::cposition_t const &  pos1,
component::cposition_t const &  pos2 
)

A method to check if a collision happened.

Parameters
rec1The first rectangle
rec2The second rectangle
pos1The first position
pos2The second position
Returns
true If a collision happened
false If no collision happened

◆ doHealthCheck()

void System::HitboxSystem::doHealthCheck ( Registry registry,
component::cnetwork_queue_t netQueue,
component::chealth_t health1,
component::chealth_t health2,
component::clobby_id_t lobbyId,
int  i,
int  x,
ENTITY_TYPE &  entityType 
)

A method to check if a collision happened between a player and a bullet.

Parameters
registryThe registry that contains all the ECS
netQueueThe network queue of the player
health1The health of entity one
health2The health of entity two
lobbyIdThe lobby id
iThe index of the entity one
xThe index of the entity two

◆ doScoreUpdate()

void System::HitboxSystem::doScoreUpdate ( component::cnetwork_queue_t netQueue,
component::clobby_id_t lobbyId,
Sparse_array< component::cscore_t > &  score,
Sparse_array< component::ctype_t > &  type,
Sparse_array< component::cowner_id_t > &  ownerId,
int  x 
)

A method to check if a collision happened between a player and a bonus.

Parameters
netQueueThe network queue of the player
lobbyIdThe lobby id
scoresThe Sparse array of all score component of all entities
typesThe Sparse array of all type component of all entities
ownerIdsThe Sparse array of all owner id component of all entities
xThe index of the entity one

◆ operator()()

void System::HitboxSystem::operator() ( Registry registry,
Sparse_array< component::cnetwork_queue_t > &  network_queues,
Sparse_array< component::ctype_t > &  types,
Sparse_array< component::cposition_t > &  positions,
Sparse_array< component::crect_t > &  rects,
Sparse_array< component::chealth_t > &  health,
Sparse_array< component::clobby_id_t > &  lobbyId,
Sparse_array< component::cscore_t > &  score,
Sparse_array< component::ctype_t > &  type,
Sparse_array< component::cowner_id_t > &  ownerId 
)

The main handler for the Hitbox System.

Parameters
registryThe registry that contains all the ECS
network_queuesThe Sparse array of all network queue component of all entities
typesThe Sparse array of all type component of all entities
positionsThe Sparse array of all position component of all entities
rectsThe Sparse array of all rect component of all entities
healthsThe Sparse array of all health component of all entities
lobbyIdsThe Sparse array of all lobby id component of all entities
scoresThe Sparse array of all score component of all entities
ownerIdsThe Sparse array of all owner id component of all entities

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