Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
system_consts.h
Go to the documentation of this file.
1#pragma once
2
3#include <SDL3/SDL.h>
4#include <cstdint>
5
6namespace Olympe {
7
8// ============================================================================
9// PIN COLORS
10// ============================================================================
11
12namespace SystemColors {
13
14 /**
15 * @brief White color for execution flow (exec) pins and connections.
16 * Used for triangle-shaped pins representing control flow.
17 */
18 constexpr uint32_t EXEC_PIN_COLOR = 0xFFFFFFFF; // RGBA: White
19
20 /**
21 * @brief Violet color for data pins and connections.
22 * Used for circle-shaped pins representing data flow.
23 */
24 constexpr uint32_t DATA_PIN_COLOR = 0xB464C8FF; // RGBA: RGB(180, 100, 200)
25
26 /**
27 * @brief Alternative white color for exec connections (Bezier curves).
28 * Same as EXEC_PIN_COLOR but used explicitly for link rendering.
29 */
30 constexpr uint32_t EXEC_CONNECTION_COLOR = 0xFFFFFFFF; // White
31
32 /**
33 * @brief Alternative violet color for data connections (Bezier curves).
34 * Same as DATA_PIN_COLOR but used explicitly for link rendering.
35 */
36 constexpr uint32_t DATA_CONNECTION_COLOR = 0xB464C8FF; // Violet
37
38 // ============================================================================
39 // BEHAVIOR TREE NODE COLORS
40 // ============================================================================
41
42 /**
43 * @brief Green color for Root node (entry point of behavior tree).
44 * Indicates the primary execution tree entry point.
45 */
46 constexpr uint32_t BT_ROOT_NODE_COLOR = 0x00FF00FF; // RGBA: Green
47
48 /**
49 * @brief Orange color for OnEvent nodes (event-driven execution).
50 * Indicates nodes that execute in response to EventQueue messages.
51 */
52 constexpr uint32_t BT_ONEVENT_NODE_COLOR = 0xFF8844FF; // RGBA: RGB(255, 136, 68)
53
54 /**
55 * @brief Yellow color for RandomSelector composite nodes.
56 * Indicates non-deterministic execution (random child selection).
57 */
58 constexpr uint32_t BT_RANDOM_NODE_COLOR = 0xFFFF00FF; // RGBA: Yellow
59
60 /**
61 * @brief Magenta color for ParallelThreshold composite nodes.
62 * Indicates parallel execution with success/failure thresholds.
63 */
64 constexpr uint32_t BT_THRESHOLD_NODE_COLOR = 0xFF00FFFF; // RGBA: Magenta
65
66 /**
67 * @brief Cyan color for Monitor decorator nodes.
68 * Indicates continuous condition monitoring during child execution.
69 */
70 constexpr uint32_t BT_MONITOR_NODE_COLOR = 0x00FFFFFF; // RGBA: Cyan
71
72 /**
73 * @brief Orange-red color for SendMessage action nodes.
74 * Indicates nodes that emit events to the EventQueue system.
75 */
76 constexpr uint32_t BT_SENDMESSAGE_ACTION_COLOR = 0xFF4422FF; // RGBA: RGB(255, 68, 34)
77
78 /**
79 * @brief Helper function to extract ImU32 color (ImGui format).
80 * ImGui uses ABGR format, so we need to swizzle RGBA to ABGR.
81 */
83 {
84 // Input: 0xRRGGBBAA
85 // Output: 0xAABBGGRR (ImGui expects ABGR)
86 uint8_t r = (rgbaColor >> 24) & 0xFF;
87 uint8_t g = (rgbaColor >> 16) & 0xFF;
88 uint8_t b = (rgbaColor >> 8) & 0xFF;
89 uint8_t a = rgbaColor & 0xFF;
90 return (a << 24) | (b << 16) | (g << 8) | r;
91 }
92
93} // namespace SystemColors
94
95} // namespace Olympe
96
97constexpr double k_PI = 3.14159265358979323846;
98
99// Configuration: defaults
100static const int DEFAULT_WINDOW_WIDTH = 800;
101static const int DEFAULT_WINDOW_HEIGHT = 600;
102
103static const short MAX_PLAYERS = 8;
104
105// Event domain types for routing events to appropriate systems
106enum class EventDomain
107{
108 Input = 0,
109 UI,
110 Gameplay,
111 System,
112 Camera,
113 Viewport,
114 Detection,
115 Collision,
116 All
117};
118
119// Event structure types
120// Used to identify the source/type of event messages
129
130// Olympe engine message identifiers
131enum class EventType
132{
134 // -------- GAME OBJECTS MESSAGES ----------
135 Olympe_EventType_Object_Activate = 0, // object activation
141 Olympe_EventType_Object_CollideDeathZone, // collision with death zone
142
143 //-------- MENU SYSTEM EVENTS ----------
147
149
150 // -------- OBBJECT EVENTS ----------
155
156 // -------- LEVEL EVENTS ----------
159
160 // -------- SECTOR EVENTS ----------
161 Olympe_EventType_SectorToActivate, // Sector to activate
162 Olympe_EventType_SectorToDeactivate, // Sector to deactivate
163
164 // -------- INPUTS EVENTS ----------
170
175
176
183
184 // -------- CAMERA EVENT ----------
185 Olympe_EventType_Camera_Shake, // shake camera with given parameters intensity, duration (milliseconds)
186 Olympe_EventType_Camera_Shake_Stop, // stop camera shake immediately
187 Olympe_EventType_Camera_Teleport, // instantly move camera to position of the renderer scene
188 Olympe_EventType_Camera_MoveToPosition, // smoothly move camera to position over time using blending (velocity)
189 Olympe_EventType_Camera_ZoomTo, // smoothly zoom camera to level over time using blending (velocity)
190 Olympe_EventType_Camera_RotateTo, // smoothly rotate camera to angle over time using blending (velocity)
191 Olympe_EventType_Camera_Reset, // reset camera to default position/zoom
192 Olympe_EventType_Camera_SetBounds, // set camera movement bounds
193 Olympe_EventType_Camera_ClearBounds, // clear camera movement bounds
194 Olympe_EventType_Camera_Mode_2D, // set camera to free 2D mode
195 Olympe_EventType_Camera_Mode_2_5D, // set camera to 2.5D mode (follow target on X axis only)
196 Olympe_EventType_Camera_Mode_Isometric, // set camera to isometric mode
197 Olympe_EventType_Camera_Target_Follow, // follow an object (given by UID or object pointer or object name)
198 Olympe_EventType_Camera_Target_Unfollow, // stop following object, return to free mode
199
200 // -------- GAME EVENTS ----------
201 Olympe_EventType_Game_Pause, // pause the game from GameMenu
202 Olympe_EventType_Game_Resume, // resume the game from GameMenu
203 Olympe_EventType_Game_Quit, // quit the game from GameMenu
204 Olympe_EventType_Game_Restart, // restart the current level from GameMenu
205 Olympe_EventType_Game_AddPlayer, // add a new player (up to 4) param: player id (0..3)
206 Olympe_EventType_Game_RemovePlayer, // remove a player param: player id (0..3)
207 Olympe_EventType_Game_TakeScreenshot, // take a screenshot of the current frame
208 Olympe_EventType_Game_SaveState, // save game state to slot (param: slot id)
209 Olympe_EventType_Game_LoadState, // load game state from slot (param: slot id)
210
211 // -------- SYSTEM EVENTS ----------
212 Olympe_EventType_System_Any, // Any system event registration
213
214 // -------- AI STIMULUS EVENTS ----------
215 Olympe_EventType_AI_Explosion, // Explosion at position (param1=x, param2=y, state=radius)
216 Olympe_EventType_AI_Noise, // Noise/sound at position (param1=x, param2=y, state=intensity)
217 Olympe_EventType_AI_DamageDealt, // Damage dealt to entity (targetUid=victim, deviceId=attacker, param1=damage)
218
221};
222
223// -------- GRID OVERLAY COLORS (backward compatibility, overridden by GridSettings_data) ----------
224static const SDL_Color COLLISION_OVERLAY_COLOR = { 150, 50, 200, 100 }; // Purple
225static const SDL_Color NAVIGATION_OVERLAY_COLOR = { 50, 200, 100, 100 }; // Green
226
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
constexpr uint32_t BT_MONITOR_NODE_COLOR
Cyan color for Monitor decorator nodes.
constexpr uint32_t BT_THRESHOLD_NODE_COLOR
Magenta color for ParallelThreshold composite nodes.
constexpr uint32_t BT_SENDMESSAGE_ACTION_COLOR
Orange-red color for SendMessage action nodes.
constexpr uint32_t BT_ONEVENT_NODE_COLOR
Orange color for OnEvent nodes (event-driven execution).
constexpr uint32_t BT_RANDOM_NODE_COLOR
Yellow color for RandomSelector composite nodes.
constexpr uint32_t EXEC_PIN_COLOR
White color for execution flow (exec) pins and connections.
constexpr uint32_t EXEC_CONNECTION_COLOR
Alternative white color for exec connections (Bezier curves).
constexpr uint32_t BT_ROOT_NODE_COLOR
Green color for Root node (entry point of behavior tree).
constexpr uint32_t DATA_CONNECTION_COLOR
Alternative violet color for data connections (Bezier curves).
constexpr uint32_t DATA_PIN_COLOR
Violet color for data pins and connections.
static uint32_t ToImU32_ABGR(uint32_t rgbaColor)
Helper function to extract ImU32 color (ImGui format).
< Provides AssetID and INVALID_ASSET_ID
static const SDL_Color COLLISION_OVERLAY_COLOR
EventType
@ Olympe_EventType_Camera_SetBounds
@ Olympe_EventType_Joystick_ButtonUp
@ Olympe_EventType_Camera_Mode_2D
@ Olympe_EventType_Camera_ClearBounds
@ Olympe_EventType_AI_DamageDealt
@ Olympe_EventType_Joystick_ButtonDown
@ Olympe_EventType_Joystick_AxisMotion
@ Olympe_EventType_Camera_RotateTo
@ Olympe_EventType_Object_Activate
@ Olympe_EventType_Camera_Teleport
@ Olympe_EventType_Keyboard_Connected
@ Olympe_EventType_Keyboard_Disconnected
@ Olympe_EventType_Game_Quit
@ Olympe_EventType_AI_Noise
@ Olympe_EventType_Game_SaveState
@ Olympe_EventType_Game_Restart
@ Olympe_EventType_Property_Add
@ Olympe_EventType_Camera_MoveToPosition
@ Olympe_EventType_Keyboard_KeyDown
@ Olympe_EventType_Mouse_ButtonDown
@ Olympe_EventType_SectorToActivate
@ Olympe_EventType_Menu_Enter
@ Olympe_EventType_Game_AddPlayer
@ Olympe_EventType_Any
@ Olympe_EventType_Object_Destroy
@ Olympe_EventType_Object_CollideDeathZone
@ Olympe_EventType_Camera_ZoomTo
@ Olympe_EventType_Camera_Mode_2_5D
@ Olympe_EventType_MAX
@ Olympe_EventType_Level_Unload
@ Olympe_EventType_Property_Remove
@ Olympe_EventType_Object_CollideEvent
@ Olympe_EventType_Object_UncollideEvent
@ Olympe_EventType_Object_Deactivate
@ Olympe_EventType_Game_LoadState
@ Olympe_EventType_Game_Resume
@ Olympe_EventType_Joystick_Connected
@ Olympe_EventType_Mouse_Connected
@ Olympe_EventType_Object_Create
@ Olympe_EventType_Object_UnCollideNav
@ Olympe_EventType_Object_CollideNav
@ Olympe_EventType_Level_Load
@ Olympe_EventType_System_Any
@ Olympe_EventType_Joystick_Disconnected
@ Olympe_EventType_Camera_Reset
@ Olympe_EventType_Camera_Target_Unfollow
@ Olympe_EventType_Mouse_Disconnected
@ Olympe_EventType_Camera_Target_Follow
@ Olympe_EventType_Game_RemovePlayer
@ Olympe_EventType_Keyboard_KeyUp
@ Olympe_EventType_Camera_Shake_Stop
@ Olympe_EventType_Camera_Mode_Isometric
@ Olympe_EventType_Camera_Shake
@ Olympe_EventType_Game_Pause
@ Olympe_EventType_Game_TakeScreenshot
@ Olympe_EventType_Mouse_ButtonUp
@ Olympe_EventType_Mouse_Motion
@ Olympe_EventType_Default
@ Olympe_EventType_Menu_Validate
@ Olympe_EventType_Mouse_Wheel
@ Olympe_EventType_Menu_Exit
@ Olympe_EventType_AI_Explosion
@ Olympe_EventType_SectorToDeactivate
static const int DEFAULT_WINDOW_HEIGHT
EventDomain
static const SDL_Color NAVIGATION_OVERLAY_COLOR
static const int DEFAULT_WINDOW_WIDTH
EventStructType
@ EventStructType_System_Windows
static const short MAX_PLAYERS
constexpr double k_PI