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
parent 2589447d0e
commit 6c5119347b
4 changed files with 22 additions and 1 deletions

View file

@ -509,6 +509,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);
@ -640,6 +641,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);
@ -1021,6 +1023,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

@ -46,6 +46,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
@ -154,6 +156,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);
@ -249,4 +252,4 @@ struct FConsoleEvent
bool IsManual;
};
#endif
#endif

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

@ -317,6 +317,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);