Add PostUiTick(). Happens after all other tickers. Useful for handling changes in the play side within the same tic.

This commit is contained in:
Marisa Kirisame 2018-03-09 02:06:41 +01:00 committed by Christoph Oelckers
parent 69c6e95b08
commit 3072c9bf7c
4 changed files with 21 additions and 0 deletions

View file

@ -515,6 +515,7 @@ DEFINE_EVENT_LOOPER(RenderFrame)
DEFINE_EVENT_LOOPER(WorldLightning)
DEFINE_EVENT_LOOPER(WorldTick)
DEFINE_EVENT_LOOPER(UiTick)
DEFINE_EVENT_LOOPER(PostUiTick)
// declarations
IMPLEMENT_CLASS(DStaticEventHandler, false, true);
@ -648,6 +649,7 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, PlayerDisconnected)
DEFINE_EMPTY_HANDLER(DStaticEventHandler, UiProcess);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, InputProcess);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, UiTick);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, PostUiTick);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, ConsoleProcess);
DEFINE_EMPTY_HANDLER(DStaticEventHandler, NetworkProcess);
@ -1044,6 +1046,18 @@ void DStaticEventHandler::UiTick()
}
}
void DStaticEventHandler::PostUiTick()
{
IFVIRTUAL(DStaticEventHandler, PostUiTick)
{
// don't create excessive DObjects if not going to be processed anyway
if (func == DStaticEventHandler_PostUiTick_VMPtr)
return;
VMValue params[1] = { (DStaticEventHandler*)this };
VMCall(func, params, 1, nullptr, 0);
}
}
void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual)
{
if (player < 0)

View file

@ -48,6 +48,8 @@ void E_WorldLightning();
void E_WorldTick();
// this executes on every tick on UI side, always
void E_UiTick();
// this executes on every tick on UI side, always AND immediately after everything else
void E_PostUiTick();
// called on each render frame once.
void E_RenderFrame();
// called after everything's been rendered, but before console/menus
@ -157,6 +159,7 @@ public:
bool InputProcess(const event_t* ev);
bool UiProcess(const event_t* ev);
void UiTick();
void PostUiTick();
//
void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual);

View file

@ -1256,6 +1256,9 @@ void G_Ticker ()
default:
break;
}
// [MK] Additional ticker for UI events right after all others
E_PostUiTick();
}

View file

@ -320,6 +320,7 @@ class StaticEventHandler : Object native play version("2.4")
virtual native ui bool UiProcess(UiEvent e);
virtual native ui bool InputProcess(InputEvent e);
virtual native ui void UiTick();
virtual native ui void PostUiTick();
//
virtual native ui void ConsoleProcess(ConsoleEvent e);