8 #define COMPONENT(com) \ 9 void com_##com##_interpolate(entity it, float a); \ 12 #define FOREACH_COMPONENT(com, body) IL_EACH(g_components, it.com_##com, body) 15 #define EVENT(T, args) .bool evt_##T##_listener; .void args evt_##T 17 #define emit(T, ...) \ 19 IL_EACH(g_events, it.evt_##T##_listener, it.evt_##T(__VA_ARGS__)); \ 22 #define subscribe(listener, T, fn) \ 24 listener.evt_##T = (fn); \ 25 listener.evt_##T##_listener = true; \ 26 IL_PUSH(g_events, listener); \ 34 #define SYSTEM(sys, frameLimit, minfps) \ 35 void sys_##sys##_update(entity this, float dt); \ 36 noref float autocvar_xon_sys_##sys##_dt = ((frameLimit) ? (1 / (frameLimit)) : 0); \ 37 noref float autocvar_xon_sys_##sys##_minfps = (1 / (1 / (minfps))) 39 #define SYSTEM_UPDATE(sys) \ 42 float dt = autocvar_xon_sys_##sys##_dt; \ 43 float minfps = autocvar_xon_sys_##sys##_minfps; \ 44 static float accumulator = 0; \ 47 accumulator += min(frametime, 1 / (minfps)); \ 49 accumulator += frametime; \ 53 while (accumulator >= dt) \ 56 FOREACH_COMPONENT(sys, sys_##sys##_update(it, dt)); \ 60 if (!a) a = accumulator / dt; \ 61 FOREACH_COMPONENT(sys, com_##sys##_interpolate(it, a)); \
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
IntrusiveList g_components