mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-18 01:21:32 +00:00
Generalized event handler definition; removed excessive VM calls when we don't have override defined.
This commit is contained in:
parent
2aadd1e13c
commit
5bfd484ae2
1 changed files with 18 additions and 65 deletions
|
@ -109,33 +109,26 @@ DEFINE_ACTION_FUNCTION(DEventHandler, Unregister)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DEventHandler, MapLoaded)
|
#define DEFINE_EVENT_HANDLER(cls, funcname) DEFINE_ACTION_FUNCTION(cls, funcname) \
|
||||||
{
|
{ \
|
||||||
PARAM_SELF_PROLOGUE(DEventHandler);
|
PARAM_SELF_PROLOGUE(cls); \
|
||||||
// do nothing
|
return 0; \
|
||||||
return 0;
|
} \
|
||||||
|
void cls::funcname() \
|
||||||
|
{ \
|
||||||
|
IFVIRTUAL(cls, funcname) \
|
||||||
|
{ \
|
||||||
|
if (func == cls##_##funcname##_VMPtr) \
|
||||||
|
return; \
|
||||||
|
VMValue params[1] = { (cls*)this }; \
|
||||||
|
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DEventHandler, MapUnloading)
|
DEFINE_EVENT_HANDLER(DEventHandler, MapLoaded)
|
||||||
{
|
DEFINE_EVENT_HANDLER(DEventHandler, MapUnloading)
|
||||||
PARAM_SELF_PROLOGUE(DEventHandler);
|
DEFINE_EVENT_HANDLER(DEventHandler, RenderFrame)
|
||||||
// do nothing
|
DEFINE_EVENT_HANDLER(DEventHandler, RenderCamera)
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DEventHandler, RenderFrame)
|
|
||||||
{
|
|
||||||
PARAM_SELF_PROLOGUE(DEventHandler);
|
|
||||||
// do nothing
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DEventHandler, RenderCamera)
|
|
||||||
{
|
|
||||||
PARAM_SELF_PROLOGUE(DEventHandler);
|
|
||||||
// do nothing
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
void DEventHandler::OnDestroy()
|
void DEventHandler::OnDestroy()
|
||||||
|
@ -144,46 +137,6 @@ void DEventHandler::OnDestroy()
|
||||||
DObject::OnDestroy();
|
DObject::OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DEventHandler::MapLoaded()
|
|
||||||
{
|
|
||||||
IFVIRTUAL(DEventHandler, MapLoaded)
|
|
||||||
{
|
|
||||||
// Without the type cast this picks the 'void *' assignment...
|
|
||||||
VMValue params[1] = { (DEventHandler*)this };
|
|
||||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DEventHandler::MapUnloading()
|
|
||||||
{
|
|
||||||
IFVIRTUAL(DEventHandler, MapUnloading)
|
|
||||||
{
|
|
||||||
// Without the type cast this picks the 'void *' assignment...
|
|
||||||
VMValue params[1] = { (DEventHandler*)this };
|
|
||||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DEventHandler::RenderFrame()
|
|
||||||
{
|
|
||||||
IFVIRTUAL(DEventHandler, RenderFrame)
|
|
||||||
{
|
|
||||||
// Without the type cast this picks the 'void *' assignment...
|
|
||||||
VMValue params[1] = { (DEventHandler*)this };
|
|
||||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DEventHandler::RenderCamera()
|
|
||||||
{
|
|
||||||
IFVIRTUAL(DEventHandler, RenderCamera)
|
|
||||||
{
|
|
||||||
// Without the type cast this picks the 'void *' assignment...
|
|
||||||
VMValue params[1] = { (DEventHandler*)this };
|
|
||||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DRenderEventHandler::Setup()
|
void DRenderEventHandler::Setup()
|
||||||
{
|
{
|
||||||
ViewPos = ::ViewPos;
|
ViewPos = ::ViewPos;
|
||||||
|
|
Loading…
Reference in a new issue