Go to the source code of this file.
|
#define | COMPONENT(com) |
| Components always interpolate from the previous state. More...
|
|
#define | emit(T, ...) |
|
#define | EVENT(T, args) .bool evt_##T##_listener; .void args evt_##T |
|
#define | FOREACH_COMPONENT(com, body) IL_EACH(g_components, it.com_##com, body) |
|
#define | subscribe(listener, T, fn) |
|
#define | SYSTEM(sys, frameLimit, minfps) |
| framelimit 0 is no limit, interpolation does not apply framerate below minfps will result in less than 100% speed More...
|
|
#define | SYSTEM_UPDATE(sys) |
|
◆ COMPONENT
Value:void com_##com##_interpolate(
entity it,
float a); \
.bool com_##com
Components always interpolate from the previous state.
Definition at line 8 of file lib.qh.
◆ emit
◆ EVENT
#define EVENT |
( |
|
T, |
|
|
|
args |
|
) |
| .bool evt_##T##_listener; .void args evt_##T |
◆ FOREACH_COMPONENT
◆ subscribe
#define subscribe |
( |
|
listener, |
|
|
|
T, |
|
|
|
fn |
|
) |
| |
Value:MACRO_BEGIN \
listener.evt_##T = (fn); \
listener.evt_##T##_listener = true; \
MACRO_END
Definition at line 22 of file lib.qh.
Referenced by STATIC_INIT().
◆ SYSTEM
#define SYSTEM |
( |
|
sys, |
|
|
|
frameLimit, |
|
|
|
minfps |
|
) |
| |
Value:void sys_##sys##_update(
entity this,
float dt); \
noref float autocvar_xon_sys_##sys##_dt = ((frameLimit) ? (1 / (frameLimit)) : 0); \
noref float autocvar_xon_sys_##sys##_minfps = (1 / (1 / (minfps)))
framelimit 0 is no limit, interpolation does not apply framerate below minfps will result in less than 100% speed
Definition at line 34 of file lib.qh.
◆ SYSTEM_UPDATE
#define SYSTEM_UPDATE |
( |
|
sys | ) |
|
Value:MACRO_BEGIN \
static float t = 0; \
float dt = autocvar_xon_sys_##sys##_dt; \
float minfps = autocvar_xon_sys_##sys##_minfps; \
static float accumulator = 0; \
float a = 0; \
if (dt) { \
} else { \
dt = accumulator; \
a = 1; \
} \
while (accumulator >= dt) \
{ \
time = t; \
FOREACH_COMPONENT(sys, sys_##sys##_update(it, dt)); \
t += dt; \
accumulator -= dt; \
} \
if (!a) a = accumulator / dt; \
FOREACH_COMPONENT(sys, com_##sys##_interpolate(it, a)); \
MACRO_END
Definition at line 39 of file lib.qh.
Referenced by systems_update().
◆ STATIC_INIT()
STATIC_INIT |
( |
components |
| ) |
|
Definition at line 5 of file lib.qh.
References IL_NEW.
IntrusiveList g_components
◆ g_components
Definition at line 4 of file lib.qh.
◆ g_events
Definition at line 3 of file lib.qh.