Skip to content

Commit 47d85a5

Browse files
committed
keybinds: ticks always propagate
1 parent aa18ea4 commit 47d85a5

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

sources/include/cage-engine/keybinds.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ namespace cage
8181
struct CAGE_ENGINE_API EngineTick
8282
{};
8383
}
84-
CAGE_ENGINE_API void keybindsDispatchGameTick();
85-
CAGE_ENGINE_API void keybindsDispatchEngineTick();
8684

8785
CAGE_ENGINE_API void keybindsGuiWidget(guiBuilder::GuiBuilder *g, Keybind *keybind);
8886
CAGE_ENGINE_API void keybindsGuiTable(guiBuilder::GuiBuilder *g, const String &filterPrefix = {});

sources/libengine/keybinds.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,17 @@ namespace cage
228228
if (active)
229229
{
230230
if (input.has<input::GameTick>() && any(config.modes & KeybindModesFlags::GameTick))
231-
return event(input);
231+
{
232+
if (event)
233+
event(input);
234+
return false; // ticks always propagate
235+
}
232236
if (input.has<input::EngineTick>() && any(config.modes & KeybindModesFlags::EngineTick))
233-
return event(input);
237+
{
238+
if (event)
239+
event(input);
240+
return false; // ticks always propagate
241+
}
234242
}
235243
for (const auto &it : matchers)
236244
{
@@ -521,20 +529,6 @@ namespace cage
521529
}
522530
}
523531

524-
void keybindsDispatchGameTick()
525-
{
526-
GenericInput g = input::GameTick();
527-
for (KeybindImpl *it : global())
528-
it->process(g);
529-
}
530-
531-
void keybindsDispatchEngineTick()
532-
{
533-
GenericInput g = input::EngineTick();
534-
for (KeybindImpl *it : global())
535-
it->process(g);
536-
}
537-
538532
void keybindsGuiWidget(GuiBuilder *g, Keybind *k_)
539533
{
540534
KeybindImpl *k = (KeybindImpl *)k_;

sources/libsimple/gameloop.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ namespace cage
355355
}
356356
{
357357
ProfilingScope profiling("keybinds engine tick");
358-
keybindsDispatchEngineTick();
358+
engineEvents().dispatch(input::EngineTick());
359359
}
360360
{
361361
ProfilingScope profiling("control callback");

0 commit comments

Comments
 (0)