Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
TaskWorldFacade.h
Go to the documentation of this file.
1/**
2 * @file TaskWorldFacade.h
3 * @brief Lightweight ECS component accessor bridge for the Task System.
4 * @author Olympe Engine
5 * @date 2026-02-24
6 *
7 * @details
8 * TaskWorldFacade provides a simple, SDL-free bridge between the Task System
9 * and the ECS layer. It holds raw pointers to the PositionComponent and
10 * MovementComponent that belong to the entity currently executing a task.
11 *
12 * In production, the ECS system responsible for driving task execution
13 * (e.g. a TaskExecutionSystem) populates a TaskWorldFacade and places it in
14 * the AtomicTaskContext before calling TaskSystem::ExecuteNode().
15 *
16 * In unit tests, a TaskWorldFacade is built directly by the test, pointing at
17 * stack-allocated component instances. This allows the World mode branch of
18 * Task_MoveToLocation (and similar tasks) to be exercised without requiring a
19 * live World / SDL context.
20 *
21 * Design notes
22 * ------------
23 * - Raw (non-owning) pointers are intentional: the lifetime of the pointed-to
24 * components is managed by the caller (ECS system or test fixture).
25 * - nullptr members are safe: tasks MUST check for nullptr before use and fall
26 * back to the LocalBlackboard path when components are absent.
27 *
28 * C++14 compliant - no C++17/20 features.
29 */
30
31#pragma once
32
33#include "../ECS/Components/PositionComponent.h"
34#include "../ECS/Components/MovementComponent.h"
35
36namespace Olympe {
37
38/**
39 * @struct TaskWorldFacade
40 * @brief Lightweight ECS component accessor passed through AtomicTaskContext.
41 *
42 * @details
43 * Both pointers default to nullptr. A task that supports World mode checks
44 * both pointers before using them; if either is nullptr the task falls back
45 * to its LocalBlackboard (headless) code path.
46 */
48{
49 /// Non-owning pointer to the entity's PositionComponent. May be nullptr.
51
52 /// Non-owning pointer to the entity's MovementComponent. May be nullptr.
54};
55
56} // namespace Olympe
< Provides AssetID and INVALID_ASSET_ID
ECS component: entity velocity and movement constraints.
ECS component: entity world-space position.
Lightweight ECS component accessor passed through AtomicTaskContext.
PositionComponent * Position
Non-owning pointer to the entity's PositionComponent. May be nullptr.
MovementComponent * Movement
Non-owning pointer to the entity's MovementComponent. May be nullptr.