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
use *;
/// The common lifecycle stage shared by `Component` and `Scene`.
///
/// Both abstractions have a per-tick update callback (`on_update`), and both
/// share the same `f64` delta-time argument. Lifting that single method into
/// a supertrait lets generic code iterate over mixed collections (e.g. a
/// registry of components and scenes) and call `on_update` uniformly.
///
/// `Component` adds `on_start`, `on_render` with a `Transform2D`, `on_destroy`,
/// and `name`. `Scene` adds `on_enter`, `on_render` without a transform,
/// `on_exit`, and `name`. `Lifecycle` intentionally exposes only the shared
/// surface — the domain-specific entry/exit and render hooks stay on the
/// sub-traits where their semantics differ.
/// The base trait for all entity components.
///
/// Components encapsulate behavior that can be attached to an `Entity`.
/// The engine calls lifecycle methods at appropriate times during the scheduler loop.