1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! Timers trigger actions at periodic or one-shot intervals.
//!
//! The timer addon provides time-based scheduling for systems and other actions.
//! Timers are synchronous and increment each frame by `delta_time`, making them
//! suitable for game logic that needs to run at specific intervals or after delays.
//!
//! # Features
//!
//! - **Periodic Intervals**: Execute actions repeatedly at fixed intervals
//! - **One-shot Timeouts**: Execute actions once after a delay
//! - **System Integration**: Attach timers to systems for scheduled execution
//! - **Start/Stop Control**: Pause and resume timers dynamically
//! - **Rate Control**: Control system execution frequency
//!
//! # Usage
//!
//! Timers can be applied to systems or standalone entities:
//!
//! ## Interval Timer (Periodic)
//!
//! ```
//! use flecs_ecs::prelude::*;
//!
//! let world = World::new();
//!
//! // Create a system that runs every 2 seconds
//! world.system::<()>()
//! .set_interval(2.0)
//! .run(|mut it| {
//! println!("System runs every 2 seconds");
//! });
//!
//! // Progress the world
//! world.progress();
//! ```
//!
//! ## Timeout Timer (One-shot)
//!
//! ```
//! use flecs_ecs::prelude::*;
//!
//! let world = World::new();
//!
//! // Create a system that runs once after 5 seconds
//! let timer_system = world.system::<()>()
//! .run(|mut it| {
//! println!("System runs once after 5 seconds");
//! });
//!
//! // Set timeout on the system entity
//! timer_system.set_timeout(5.0);
//!
//! world.progress();
//! ```
//!
//! ## Timer Control
//!
//! ```
//! use flecs_ecs::prelude::*;
//!
//! let world = World::new();
//!
//! let timer = world.system::<()>()
//! .set_interval(1.0)
//! .run(|mut it| {
//! println!("Tick!");
//! });
//!
//! // Stop the timer
//! timer.stop();
//!
//! // Start it again
//! timer.start();
//! ```
//!
//! # See also
//!
//! - [`TimerAPI`] - Trait providing timer operations
//! - [`System::set_interval()`](crate::addons::system::System::set_interval)
//! - [`System::set_timeout()`](crate::addons::system::System::set_timeout)
pub use *;