Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1
9#ifdef FLECS_TIMER
10
19#ifndef FLECS_MODULE
20#define FLECS_MODULE
21#endif
22
23#ifndef FLECS_PIPELINE
24#define FLECS_PIPELINE
25#endif
26
27#ifndef FLECS_TIMER_H
28#define FLECS_TIMER_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
43
51
52
71FLECS_API
73 ecs_world_t *world,
74 ecs_entity_t tick_source,
75 ecs_ftime_t timeout);
76
96FLECS_API
98 const ecs_world_t *world,
99 ecs_entity_t tick_source);
100
118FLECS_API
120 ecs_world_t *world,
121 ecs_entity_t tick_source,
122 ecs_ftime_t interval);
123
132FLECS_API
134 const ecs_world_t *world,
135 ecs_entity_t tick_source);
136
143FLECS_API
145 ecs_world_t *world,
146 ecs_entity_t tick_source);
147
154FLECS_API
156 ecs_world_t *world,
157 ecs_entity_t tick_source);
158
165FLECS_API
167 ecs_world_t *world,
168 ecs_entity_t tick_source);
169
176FLECS_API
178 ecs_world_t *world);
179
210FLECS_API
212 ecs_world_t *world,
213 ecs_entity_t tick_source,
214 int32_t rate,
215 ecs_entity_t source);
216
239FLECS_API
241 ecs_world_t *world,
242 ecs_entity_t system,
243 ecs_entity_t tick_source);
244
245
249
258FLECS_API
260 ecs_world_t *world);
261
262#ifdef __cplusplus
263}
264#endif
265
266#endif
267
270#endif
FLECS_API ecs_ftime_t ecs_get_timeout(const ecs_world_t *world, ecs_entity_t tick_source)
Get current timeout value for the specified timer.
FLECS_API void ecs_reset_timer(ecs_world_t *world, ecs_entity_t tick_source)
Reset time value of timer to 0.
FLECS_API ecs_entity_t ecs_set_interval(ecs_world_t *world, ecs_entity_t tick_source, ecs_ftime_t interval)
Set timer interval.
FLECS_API ecs_ftime_t ecs_get_interval(const ecs_world_t *world, ecs_entity_t tick_source)
Get current interval value for the specified timer.
FLECS_API void ecs_set_tick_source(ecs_world_t *world, ecs_entity_t system, ecs_entity_t tick_source)
Assign tick source to system.
FLECS_API ecs_entity_t ecs_set_rate(ecs_world_t *world, ecs_entity_t tick_source, int32_t rate, ecs_entity_t source)
Set rate filter.
FLECS_API void FlecsTimerImport(ecs_world_t *world)
Timer module import function.
struct EcsTimer EcsTimer
Component used for one shot/interval timer functionality.
FLECS_API void ecs_start_timer(ecs_world_t *world, ecs_entity_t tick_source)
Start timer.
FLECS_API void ecs_randomize_timers(ecs_world_t *world)
Enable randomizing initial time value of timers.
FLECS_API ecs_entity_t ecs_set_timeout(ecs_world_t *world, ecs_entity_t tick_source, ecs_ftime_t timeout)
Set timer timeout.
FLECS_API void ecs_stop_timer(ecs_world_t *world, ecs_entity_t tick_source)
Stop timer This operation stops a timer from triggering.
struct EcsRateFilter EcsRateFilter
Apply a rate filter to a tick source.
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:347
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:391
#define ecs_ftime_t
Customizable precision for scalar time values.
Definition flecs.h:59
Apply a rate filter to a tick source.
Definition timer.h:45
int32_t rate
Rate of the rate filter.
Definition timer.h:47
int32_t tick_count
Number of times the rate filter ticked.
Definition timer.h:48
ecs_ftime_t time_elapsed
Time elapsed since last tick.
Definition timer.h:49
ecs_entity_t src
Source of the rate filter.
Definition timer.h:46
Component used for one shot/interval timer functionality.
Definition timer.h:35
ecs_ftime_t time
Incrementing time value.
Definition timer.h:37
bool active
Is the timer active or not.
Definition timer.h:40
bool single_shot
Is this a single shot timer.
Definition timer.h:41
ecs_ftime_t overshoot
Used to correct returned interval time.
Definition timer.h:38
int32_t fired_count
Number of times ticked.
Definition timer.h:39
ecs_ftime_t timeout
Timer timeout period.
Definition timer.h:36