Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Task_GetDeltaTime.cpp
Go to the documentation of this file.
1/**
2 * @file Task_GetDeltaTime.cpp
3 * @brief Atomic task: write the current frame delta-time to the LocalBlackboard.
4 * @author Olympe Engine
5 * @date 2026-03-08
6 *
7 * C++14 compliant - no C++17/20 features.
8 */
9
10#include "Task_GetDeltaTime.h"
11#include "../../AtomicTaskRegistry.h"
12#include "../../LocalBlackboard.h"
13#include "../../../system/system_utils.h"
14
15namespace Olympe {
16
18
20{
21 SYSTEM_LOG << "[Task_GetDeltaTime] Abort()\n";
22}
23
25{
26 return TaskStatus::Failure; // requires context; use ExecuteWithContext
27}
28
30 const ParameterMap& /*params*/)
31{
32 if (!ctx.LocalBB)
33 {
34 SYSTEM_LOG << "[Task_GetDeltaTime] No LocalBlackboard in context\n";
36 }
37
38 ctx.LocalBB->SetValueScoped("local:DeltaTime", TaskValue(ctx.DeltaTime));
39
40 SYSTEM_LOG << "[Task_GetDeltaTime] Entity " << ctx.Entity
41 << " dt=" << ctx.DeltaTime << " written to 'local:DeltaTime'\n";
43}
44
45REGISTER_ATOMIC_TASK(Task_GetDeltaTime, "Task_GetDeltaTime")
46
47} // namespace Olympe
#define REGISTER_ATOMIC_TASK(ClassName, Id)
Registers a factory for ClassName under Id at static init time.
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Atomic task that writes the current delta-time into the LocalBlackboard.
std::unordered_map< std::string, TaskValue > ParameterMap
Convenience alias for the parameter map passed to Execute().
Definition IAtomicTask.h:67
C++14-compliant type-safe value container for task parameters.
Writes ctx.DeltaTime to "local:DeltaTime" in the LocalBlackboard.
void Abort() override
Aborts the task, releasing any in-progress state.
TaskStatus Execute(const ParameterMap &params) override
Executes the atomic task for one frame.
TaskStatus ExecuteWithContext(const AtomicTaskContext &ctx, const ParameterMap &params) override
Executes the atomic task for one frame with full runtime context.
< Provides AssetID and INVALID_ASSET_ID
TaskStatus
Result code returned by IAtomicTask::Execute().
Definition IAtomicTask.h:38
@ Success
Task completed successfully.
@ Failure
Task failed.
Lightweight context bundle passed to IAtomicTask::ExecuteWithContext().
#define SYSTEM_LOG