Flecs v4.1
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
89FLECS_API
91 const ecs_world_t *world,
92 ecs_entity_t tick_source);
93
111FLECS_API
113 ecs_world_t *world,
114 ecs_entity_t tick_source,
115 ecs_ftime_t interval);
116
125FLECS_API
127 const ecs_world_t *world,
128 ecs_entity_t tick_source);
129
136FLECS_API
138 ecs_world_t *world,
139 ecs_entity_t tick_source);
140
147FLECS_API
149 ecs_world_t *world,
150 ecs_entity_t tick_source);
151
158FLECS_API
160 ecs_world_t *world,
161 ecs_entity_t tick_source);
162
169FLECS_API
171 ecs_world_t *world);
172
203FLECS_API
205 ecs_world_t *world,
206 ecs_entity_t tick_source,
207 int32_t rate,
208 ecs_entity_t source);
209
232FLECS_API
234 ecs_world_t *world,
235 ecs_entity_t system,
236 ecs_entity_t tick_source);
237
238
242
251FLECS_API
253 ecs_world_t *world);
254
255#ifdef __cplusplus
256}
257#endif
258
259#endif
260
263#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 and 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.
struct EcsRateFilter EcsRateFilter
Apply a rate filter to a tick source.
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:381
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:425
#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 and 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