2017-01-22 06:56:57 +00:00
|
|
|
class StaticEventHandler : Object native
|
2017-01-22 02:15:30 +00:00
|
|
|
{
|
2017-01-30 07:28:27 +00:00
|
|
|
// static event handlers CAN register other static event handlers.
|
|
|
|
// unlike EventHandler.Create that will not create them.
|
|
|
|
protected static native StaticEventHandler Create(class<StaticEventHandler> type);
|
|
|
|
protected static native StaticEventHandler CreateOnce(class<StaticEventHandler> type);
|
2017-01-30 07:33:06 +00:00
|
|
|
protected static native StaticEventHandler Find(Class<StaticEventHandler> type); // just for convenience. who knows.
|
2017-01-30 07:28:27 +00:00
|
|
|
|
|
|
|
protected static native bool Register(StaticEventHandler handler);
|
|
|
|
protected static native bool Unregister(StaticEventHandler handler);
|
|
|
|
|
2017-01-30 09:56:03 +00:00
|
|
|
// world stuff
|
|
|
|
virtual void WorldLoaded() {}
|
|
|
|
virtual void WorldUnloaded() {}
|
|
|
|
virtual void WorldThingSpawned() {}
|
|
|
|
// render stuff
|
|
|
|
virtual void RenderFrame() {}
|
2017-01-22 02:15:30 +00:00
|
|
|
}
|
|
|
|
|
2017-01-22 06:56:57 +00:00
|
|
|
class StaticRenderEventHandler : StaticEventHandler native
|
2017-01-22 02:15:30 +00:00
|
|
|
{
|
2017-01-30 09:56:03 +00:00
|
|
|
// for frame and camera
|
|
|
|
native readonly Vector3 ViewPos;
|
|
|
|
native readonly double ViewAngle;
|
|
|
|
native readonly double ViewPitch;
|
|
|
|
native readonly double ViewRoll;
|
|
|
|
native readonly double FracTic;
|
|
|
|
native readonly Actor Camera;
|
2017-01-22 06:56:57 +00:00
|
|
|
}
|
|
|
|
|
2017-01-30 06:47:15 +00:00
|
|
|
class StaticWorldEventHandler : StaticEventHandler native
|
|
|
|
{
|
|
|
|
// for world
|
|
|
|
native readonly bool IsSaveGame; // this is set to true if static WorldLoaded was triggered during savegame loading.
|
|
|
|
native readonly Actor Thing; // this is for WorldThingSpawned
|
|
|
|
}
|
|
|
|
|
2017-01-22 06:56:57 +00:00
|
|
|
class EventHandler : StaticEventHandler native
|
|
|
|
{
|
2017-01-30 09:56:03 +00:00
|
|
|
static native StaticEventHandler Create(class<StaticEventHandler> type);
|
|
|
|
static native StaticEventHandler CreateOnce(class<StaticEventHandler> type);
|
|
|
|
static native StaticEventHandler Find(class<StaticEventHandler> type);
|
2017-01-22 06:56:57 +00:00
|
|
|
|
2017-01-30 09:56:03 +00:00
|
|
|
static native bool Register(StaticEventHandler handler);
|
|
|
|
static native bool Unregister(StaticEventHandler handler);
|
2017-01-22 06:56:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class RenderEventHandler : StaticRenderEventHandler native { }
|