mirror of https://github.com/ZDoom/gzdoom-gles.git
Added: UiTick in EventHandlers, a callback that executes at 35fps on every handler in ui scope;
Removed: RenderOverlay, RenderFrame (commented out), Create, CreateOnce, Register, Unregister (completely)
This commit is contained in:
parent
e080f0cf89
commit
01561eb768
|
@ -471,6 +471,7 @@ DEFINE_EVENT_LOOPER(RenderFrame)
|
||||||
DEFINE_EVENT_LOOPER(RenderOverlay)
|
DEFINE_EVENT_LOOPER(RenderOverlay)
|
||||||
DEFINE_EVENT_LOOPER(WorldLightning)
|
DEFINE_EVENT_LOOPER(WorldLightning)
|
||||||
DEFINE_EVENT_LOOPER(WorldTick)
|
DEFINE_EVENT_LOOPER(WorldTick)
|
||||||
|
DEFINE_EVENT_LOOPER(UiTick)
|
||||||
|
|
||||||
// declarations
|
// declarations
|
||||||
IMPLEMENT_CLASS(DStaticEventHandler, false, true);
|
IMPLEMENT_CLASS(DStaticEventHandler, false, true);
|
||||||
|
@ -686,6 +687,7 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, PlayerDisconnected)
|
||||||
|
|
||||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, UiProcess);
|
DEFINE_EMPTY_HANDLER(DStaticEventHandler, UiProcess);
|
||||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, InputProcess);
|
DEFINE_EMPTY_HANDLER(DStaticEventHandler, InputProcess);
|
||||||
|
DEFINE_EMPTY_HANDLER(DStaticEventHandler, UiTick);
|
||||||
|
|
||||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, ConsoleProcess);
|
DEFINE_EMPTY_HANDLER(DStaticEventHandler, ConsoleProcess);
|
||||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, NetworkProcess);
|
DEFINE_EMPTY_HANDLER(DStaticEventHandler, NetworkProcess);
|
||||||
|
@ -851,9 +853,8 @@ void DStaticEventHandler::WorldTick()
|
||||||
// don't create excessive DObjects if not going to be processed anyway
|
// don't create excessive DObjects if not going to be processed anyway
|
||||||
if (func == DStaticEventHandler_WorldTick_VMPtr)
|
if (func == DStaticEventHandler_WorldTick_VMPtr)
|
||||||
return;
|
return;
|
||||||
FWorldEvent e = E_SetupWorldEvent();
|
VMValue params[2] = { (DStaticEventHandler*)this };
|
||||||
VMValue params[2] = { (DStaticEventHandler*)this, &e };
|
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||||
GlobalVMStack.Call(func, params, 2, nullptr, 0, nullptr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,6 +1055,18 @@ bool DStaticEventHandler::InputProcess(const event_t* ev)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DStaticEventHandler::UiTick()
|
||||||
|
{
|
||||||
|
IFVIRTUAL(DStaticEventHandler, UiTick)
|
||||||
|
{
|
||||||
|
// don't create excessive DObjects if not going to be processed anyway
|
||||||
|
if (func == DStaticEventHandler_UiTick_VMPtr)
|
||||||
|
return;
|
||||||
|
VMValue params[2] = { (DStaticEventHandler*)this };
|
||||||
|
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual)
|
void DStaticEventHandler::ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual)
|
||||||
{
|
{
|
||||||
if (player < 0)
|
if (player < 0)
|
||||||
|
|
|
@ -41,8 +41,10 @@ void E_WorldThingDamaged(AActor* actor, AActor* inflictor, AActor* source, int d
|
||||||
void E_WorldThingDestroyed(AActor* actor);
|
void E_WorldThingDestroyed(AActor* actor);
|
||||||
// same as ACS SCRIPT_Lightning
|
// same as ACS SCRIPT_Lightning
|
||||||
void E_WorldLightning();
|
void E_WorldLightning();
|
||||||
// this executes on every tick, before everything
|
// this executes on every tick, before everything, only when in valid level and not paused
|
||||||
void E_WorldTick();
|
void E_WorldTick();
|
||||||
|
// this executes on every tick on UI side, always
|
||||||
|
void E_UiTick();
|
||||||
// called on each render frame once.
|
// called on each render frame once.
|
||||||
void E_RenderFrame();
|
void E_RenderFrame();
|
||||||
// called after everything's been rendered, but before console/menus
|
// called after everything's been rendered, but before console/menus
|
||||||
|
@ -150,6 +152,7 @@ public:
|
||||||
// return true if handled.
|
// return true if handled.
|
||||||
bool InputProcess(const event_t* ev);
|
bool InputProcess(const event_t* ev);
|
||||||
bool UiProcess(const event_t* ev);
|
bool UiProcess(const event_t* ev);
|
||||||
|
void UiTick();
|
||||||
|
|
||||||
//
|
//
|
||||||
void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual);
|
void ConsoleProcess(int player, FString name, int arg1, int arg2, int arg3, bool manual);
|
||||||
|
|
|
@ -1223,6 +1223,9 @@ void G_Ticker ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [ZZ] also tick the UI part of the events
|
||||||
|
E_UiTick();
|
||||||
|
|
||||||
// do main actions
|
// do main actions
|
||||||
switch (gamestate)
|
switch (gamestate)
|
||||||
{
|
{
|
||||||
|
|
|
@ -285,13 +285,8 @@ class StaticEventHandler : Object native play version("2.4")
|
||||||
{
|
{
|
||||||
// static event handlers CAN register other static event handlers.
|
// static event handlers CAN register other static event handlers.
|
||||||
// unlike EventHandler.Create that will not create them.
|
// unlike EventHandler.Create that will not create them.
|
||||||
clearscope static native StaticEventHandler Create(class<StaticEventHandler> type);
|
|
||||||
clearscope static native StaticEventHandler CreateOnce(class<StaticEventHandler> type);
|
|
||||||
clearscope static native StaticEventHandler Find(Class<StaticEventHandler> type); // just for convenience. who knows.
|
clearscope static native StaticEventHandler Find(Class<StaticEventHandler> type); // just for convenience. who knows.
|
||||||
|
|
||||||
clearscope static native bool Register(StaticEventHandler handler);
|
|
||||||
clearscope static native bool Unregister(StaticEventHandler handler);
|
|
||||||
|
|
||||||
// these are called when the handler gets registered or unregistered
|
// these are called when the handler gets registered or unregistered
|
||||||
// you can set Order/IsUiProcessor here.
|
// you can set Order/IsUiProcessor here.
|
||||||
virtual native void OnRegister();
|
virtual native void OnRegister();
|
||||||
|
@ -306,11 +301,11 @@ class StaticEventHandler : Object native play version("2.4")
|
||||||
virtual native void WorldThingDamaged(WorldEvent e);
|
virtual native void WorldThingDamaged(WorldEvent e);
|
||||||
virtual native void WorldThingDestroyed(WorldEvent e);
|
virtual native void WorldThingDestroyed(WorldEvent e);
|
||||||
virtual native void WorldLightning(WorldEvent e); // for the sake of completeness.
|
virtual native void WorldLightning(WorldEvent e); // for the sake of completeness.
|
||||||
virtual native void WorldTick(WorldEvent e);
|
virtual native void WorldTick();
|
||||||
|
|
||||||
//
|
//
|
||||||
virtual native ui void RenderFrame(RenderEvent e);
|
//virtual native ui void RenderFrame(RenderEvent e);
|
||||||
virtual native ui void RenderOverlay(RenderEvent e);
|
//virtual native ui void RenderOverlay(RenderEvent e);
|
||||||
|
|
||||||
//
|
//
|
||||||
virtual native void PlayerEntered(PlayerEvent e);
|
virtual native void PlayerEntered(PlayerEvent e);
|
||||||
|
@ -321,6 +316,7 @@ class StaticEventHandler : Object native play version("2.4")
|
||||||
//
|
//
|
||||||
virtual native ui bool UiProcess(UiEvent e);
|
virtual native ui bool UiProcess(UiEvent e);
|
||||||
virtual native ui bool InputProcess(InputEvent e);
|
virtual native ui bool InputProcess(InputEvent e);
|
||||||
|
virtual native ui void UiTick();
|
||||||
|
|
||||||
//
|
//
|
||||||
virtual native ui void ConsoleProcess(ConsoleEvent e);
|
virtual native ui void ConsoleProcess(ConsoleEvent e);
|
||||||
|
@ -339,12 +335,6 @@ class StaticEventHandler : Object native play version("2.4")
|
||||||
|
|
||||||
class EventHandler : StaticEventHandler native version("2.4")
|
class EventHandler : StaticEventHandler native version("2.4")
|
||||||
{
|
{
|
||||||
clearscope static native StaticEventHandler Create(class<StaticEventHandler> type);
|
|
||||||
clearscope static native StaticEventHandler CreateOnce(class<StaticEventHandler> type);
|
|
||||||
clearscope static native StaticEventHandler Find(class<StaticEventHandler> type);
|
clearscope static native StaticEventHandler Find(class<StaticEventHandler> type);
|
||||||
|
|
||||||
clearscope static native bool Register(StaticEventHandler handler);
|
|
||||||
clearscope static native bool Unregister(StaticEventHandler handler);
|
|
||||||
|
|
||||||
clearscope static native void SendNetworkEvent(String name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
|
clearscope static native void SendNetworkEvent(String name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue