r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
utl Namespace Reference

Namespaces

namespace  cli
 
namespace  Config
 
namespace  GameConfig
 
namespace  Path
 
namespace  srv
 

Classes

class  Clock
 Class for clock. More...
 
class  Event
 Event structure for inter-component communication. More...
 
class  EventBus
 Thread-safe event bus for decoupled component communication. More...
 
struct  EventConnect
 
class  EventStats
 Event statistics structure. More...
 
interface  IPlugin
 Interface for plugins. More...
 
class  Logger
 Class for logging. More...
 
class  PluginLoader
 Modern, type-safe plugin loader. More...
 
struct  SharedLib
 Handle to a dynamic library with RAII. More...
 

Typedefs

using LibHandle
 
using EntryPointFn = IPlugin *(*)()
 

Enumerations

enum class  EventType : std::uint32_t {
  WORLD_STATE_RECEIVED = 0x1000 , ENTITY_EVENTS_RECEIVED = 0x1001 , PLAYER_CONNECTED = 0x1002 , PLAYER_DISCONNECTED = 0x1003 ,
  PLAYER_INPUT_RECEIVED = 0x1010 , ENTITY_EVENT_RECEIVED = 0x1011 , CONNECTION_ACCEPTED = 0x1020 , CONNECTION_REJECTED = 0x1021 ,
  SERVER_DISCONNECTED = 0x1022 , SEND_PLAYER_INPUT = 0x2000 , SEND_ENTITY_EVENT = 0x2001 , SEND_ENTITY_EVENTS = 0x2002 ,
  BROADCAST_WORLD_STATE = 0x2003 , BROADCAST_TO_CLIENTS = 0x2004 , SEND_TO_CLIENT = 0x2010 , DISCONNECT_CLIENT = 0x2011 ,
  REQUEST_CONNECT = 0x2020 , REQUEST_DISCONNECT = 0x2021 , SERVER_START = 0x3000 , SERVER_STOP = 0x3001 ,
  SERVER_STATUS_UPDATE = 0x3002 , LOBBY_LIST_REQUEST = 0x4000 , LOBBY_LIST_RESPONSE = 0x4001 , LOBBY_CREATE = 0x4010 ,
  LOBBY_CREATE_RESPONSE = 0x4011 , LOBBY_JOIN = 0x4020 , LOBBY_JOIN_RESPONSE = 0x4021 , LOBBY_LEAVE = 0x4030 ,
  LOBBY_UPDATE = 0x4040 , GAME_START = 0x4050 , GAME_OVER = 0x4060
}
 Event types for inter-component communication. More...
 
enum class  EventPriority : std::uint8_t { LOW = 0 , NORMAL = 1 , HIGH = 2 , CRITICAL = 3 }
 Event priority levels. More...
 
enum class  PluginType : uint8_t {
  AUDIO = 0 , NETWORK_CLIENT = 1 , NETWORK_SERVER = 1 , RENDERER = 2 ,
  GAME_CLIENT = 3 , GAME_SERVER = 4 , UNKNOWN = 255
}
 
enum class  LogLevel : uint8_t { INFO , WARNING }
 

Functions

std::pair< float, float > calculateSpriteCenter (const float x, const float y, const float spriteWidth, const float spriteHeight, const float scale)
 Calculate the center position of a sprite.
 
std::pair< float, float > calculateHitboxOffsets (const float spriteWidth, const float spriteHeight, const float scale)
 Calculate hitbox offsets to center the hitbox on the sprite.
 
std::pair< float, float > calculateHitboxOffsetsRelative (const float x, const float y, const float spriteWidth, const float spriteHeight, const float scale)
 Calculate hitbox offsets relative to sprite position.
 
std::vector< char > readFile (const std::string &filename)
 
std::unordered_map< std::string, std::string > getEnvMap (const char *const *env)
 

Variables

static constexpr std::uint32_t NETWORK_CLIENT = 1
 
static constexpr std::uint32_t NETWORK_SERVER = 2
 
static constexpr std::uint32_t GAME_LOGIC = 3
 
static constexpr std::uint32_t RENDERING_ENGINE = 4
 

Typedef Documentation

◆ EntryPointFn

using utl::EntryPointFn = IPlugin *(*)()

Definition at line 78 of file PluginLoader.hpp.

◆ LibHandle

Initial value:
void *

Definition at line 34 of file PluginLoader.hpp.

Enumeration Type Documentation

◆ EventPriority

enum class utl::EventPriority : std::uint8_t
strong

Event priority levels.

Enumerator
LOW 
NORMAL 
HIGH 
CRITICAL 

Definition at line 70 of file Event.hpp.

◆ EventType

enum class utl::EventType : std::uint32_t
strong

Event types for inter-component communication.

Enumerator
WORLD_STATE_RECEIVED 
ENTITY_EVENTS_RECEIVED 
PLAYER_CONNECTED 
PLAYER_DISCONNECTED 
PLAYER_INPUT_RECEIVED 
ENTITY_EVENT_RECEIVED 
CONNECTION_ACCEPTED 
CONNECTION_REJECTED 
SERVER_DISCONNECTED 
SEND_PLAYER_INPUT 
SEND_ENTITY_EVENT 
SEND_ENTITY_EVENTS 
BROADCAST_WORLD_STATE 
BROADCAST_TO_CLIENTS 
SEND_TO_CLIENT 
DISCONNECT_CLIENT 
REQUEST_CONNECT 
REQUEST_DISCONNECT 
SERVER_START 
SERVER_STOP 
SERVER_STATUS_UPDATE 
LOBBY_LIST_REQUEST 
LOBBY_LIST_RESPONSE 
LOBBY_CREATE 
LOBBY_CREATE_RESPONSE 
LOBBY_JOIN 
LOBBY_JOIN_RESPONSE 
LOBBY_LEAVE 
LOBBY_UPDATE 
GAME_START 
GAME_OVER 

Definition at line 25 of file Event.hpp.

◆ LogLevel

enum class utl::LogLevel : uint8_t
strong
Enumerator
INFO 
WARNING 

Definition at line 17 of file Logger.hpp.

◆ PluginType

enum class utl::PluginType : uint8_t
strong
Enumerator
AUDIO 
NETWORK_CLIENT 
NETWORK_SERVER 
RENDERER 
GAME_CLIENT 
GAME_SERVER 
UNKNOWN 

Definition at line 21 of file IPlugin.hpp.

Function Documentation

◆ calculateHitboxOffsets()

std::pair< float, float > utl::calculateHitboxOffsets ( const float spriteWidth,
const float spriteHeight,
const float scale )
inline

Calculate hitbox offsets to center the hitbox on the sprite.

Parameters
spriteWidthSprite width
spriteHeightSprite height
scaleSprite scale
Returns
Pair of (offsetX, offsetY)

Definition at line 35 of file HitboxUtils.hpp.

Referenced by gme::Game::createPlayer(), gme::GameSolo::createPlayer(), gme::PlayerControllerMulti::createPlayer(), gme::ProjectileManager::createProjectile(), and gme::GameMulti::handleWorldStateUpdate().

+ Here is the caller graph for this function:

◆ calculateHitboxOffsetsRelative()

std::pair< float, float > utl::calculateHitboxOffsetsRelative ( const float x,
const float y,
const float spriteWidth,
const float spriteHeight,
const float scale )
inline

Calculate hitbox offsets relative to sprite position.

Parameters
xSprite X position
ySprite Y position
spriteWidthSprite width
spriteHeightSprite height
scaleSprite scale
Returns
Pair of (offsetX, offsetY) relative to sprite position

Definition at line 50 of file HitboxUtils.hpp.

References calculateSpriteCenter().

Referenced by gme::SpawnSystem::spawnEnemy(), and gme::SpawnSystem::spawnWave().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateSpriteCenter()

std::pair< float, float > utl::calculateSpriteCenter ( const float x,
const float y,
const float spriteWidth,
const float spriteHeight,
const float scale )
inline

Calculate the center position of a sprite.

Parameters
xSprite X position
ySprite Y position
spriteWidthSprite width
spriteHeightSprite height
scaleSprite scale
Returns
Pair of (centerX, centerY)

Definition at line 22 of file HitboxUtils.hpp.

Referenced by calculateHitboxOffsetsRelative().

+ Here is the caller graph for this function:

◆ getEnvMap()

std::unordered_map< std::string, std::string > utl::getEnvMap ( const char *const * env)
nodiscard

Definition at line 30 of file utils.cpp.

◆ readFile()

std::vector< char > utl::readFile ( const std::string & filename)
nodiscard

Definition at line 9 of file utils.cpp.

Variable Documentation

◆ GAME_LOGIC

◆ NETWORK_CLIENT

◆ NETWORK_SERVER

std::uint32_t utl::NETWORK_SERVER = 2
staticconstexpr

◆ RENDERING_ENGINE

std::uint32_t utl::RENDERING_ENGINE = 4
staticconstexpr

Definition at line 20 of file Event.hpp.

Referenced by eng::AsioClient::handleConnectAccept().