Skip to main content

types Namespace

Core types for game state management. More...

Definition

namespace helios::engine::mechanics::gamestate::types { ... }

Typedefs Index

usingGameStateType = uint16_t

Underlying type for GameState bitmask values. More...

Enumerations Index

enum classGameState : GameStateType { ... }

Enumeration of possible game states. More...

enum classGameStateTransitionId : uint16_t { ... }

Enumeration of transition identifiers. More...

Operators Index

constexpr GameStateoperator| (const GameState lhs, const GameState rhs) noexcept

Bitwise OR operator for combining game states. More...

constexpr GameStateoperator& (const GameState lhs, const GameState rhs) noexcept

Bitwise AND operator for masking game states. More...

constexpr GameStateoperator~ (const GameState lhs) noexcept

Bitwise NOT operator for inverting game state bits. More...

Functions Index

constexpr boolhasFlag (const GameState mask, const GameState flag) noexcept

Checks if a flag is set in a state mask. More...

Variables Index

constexpr size_tGameStateTypeSize = 16

Description

Core types for game state management.

Contains enums, structs, and classes for state machine operations.

Typedefs

GameStateType

using helios::engine::mechanics::gamestate::types::GameStateType = uint16_t

Underlying type for GameState bitmask values.

Definition at line 18 of file GameState.ixx.

18 using GameStateType = uint16_t;

Enumerations

GameState

enum class helios::engine::mechanics::gamestate::types::GameState : GameStateType
strong

Enumeration of possible game states.

Enumeration values
Undefined (= 0)
Booting (= 1 << 0)
Booted (= 1 << 1)
Warmup (= 1 << 2)
Title (= 1 << 3)
MatchReady (= 1 << 4)
Running (= 1 << 5)
Paused (= 1 << 6)
Shutdown (= 1 << 7)
AnyBitmask representing all base/ single-bit state flags (= Booting | Booted | Running | MatchReady | Title | Paused | Shutdown | Warmup)
LiveBitmask representing any running state, i.e. any state except Booting, Booted, Warmup and Shutdown (= Any & ~(Booting | Booted | Warmup | Shutdown))

States can be combined using bitwise operators for masking.

Definition at line 27 of file GameState.ixx.

27 enum class GameState : GameStateType {
28
30
31 Booting = 1 << 0,
32
33 Booted = 1 << 1,
34
35 Warmup = 1 << 2,
36
37 Title = 1 << 3,
38
39 MatchReady = 1 << 4,
40
41 Running = 1 << 5,
42
43 Paused = 1 << 6,
44
45 Shutdown = 1 << 7,
46
47
48 /**
49 * @brief Bitmask representing all base/ single-bit state flags.
50 */
52
53 /**
54 * @brief Bitmask representing any running state, i.e. any state except Booting, Booted, Warmup and Shutdown.
55 */
57
58
59 };

GameStateTransitionId

enum class helios::engine::mechanics::gamestate::types::GameStateTransitionId : uint16_t
strong

Enumeration of transition identifiers.

Enumeration values
Undefined (= 0)
BootRequest
WarmupRequest
ReadyMatchRequest
StartMatchRequest
TogglePause
TitleRequest
ShutdownRequest

Each identifier represents a specific type of state transition request.

Definition at line 21 of file GameStateTransitionId.ixx.

Operators

operator&()

GameState helios::engine::mechanics::gamestate::types::operator& (const GameState lhs, const GameState rhs)
nodiscard constexpr noexcept

Bitwise AND operator for masking game states.

Definition at line 71 of file GameState.ixx.

71 [[nodiscard]] constexpr GameState operator&(const GameState lhs, const GameState rhs) noexcept {
72 return static_cast<GameState>(static_cast<GameStateType>(lhs) & static_cast<GameStateType>(rhs));
73 }

operator|()

GameState helios::engine::mechanics::gamestate::types::operator| (const GameState lhs, const GameState rhs)
nodiscard constexpr noexcept

Bitwise OR operator for combining game states.

Definition at line 64 of file GameState.ixx.

64 [[nodiscard]] constexpr GameState operator|(const GameState lhs, const GameState rhs) noexcept {
65 return static_cast<GameState>(static_cast<GameStateType>(lhs) | static_cast<GameStateType>(rhs));
66 }

operator~()

GameState helios::engine::mechanics::gamestate::types::operator~ (const GameState lhs)
nodiscard constexpr noexcept

Bitwise NOT operator for inverting game state bits.

Definition at line 78 of file GameState.ixx.

78 [[nodiscard]] constexpr GameState operator~(const GameState lhs) noexcept {
79 return static_cast<GameState>((~static_cast<GameStateType>(lhs)) & static_cast<GameStateType>(GameState::Any));
80 }

Reference Any.

Functions

hasFlag()

bool helios::engine::mechanics::gamestate::types::hasFlag (const GameState mask, const GameState flag)
nodiscard constexpr noexcept

Checks if a flag is set in a state mask.

Parameters
mask

The state mask to check.

flag

The flag to check for.

Returns

True if the flag is set in the mask.

Definition at line 90 of file GameState.ixx.

90 [[nodiscard]] constexpr bool hasFlag(const GameState mask, const GameState flag) noexcept {
91 return (mask & flag) == flag;
92 }

Variables

GameStateTypeSize

size_t helios::engine::mechanics::gamestate::types::GameStateTypeSize = 16
constexpr

Definition at line 20 of file GameState.ixx.

20 constexpr size_t GameStateTypeSize = 16;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.