Send events through queue instead of calling game methods directly

This commit is contained in:
Phil Marell
2021-08-08 16:59:27 +10:00
parent 744b06796d
commit 5b5fb15780
6 changed files with 54 additions and 11 deletions

View File

@@ -1,4 +1,6 @@
#import "AerofoilApplication.h"
#include "IGpVOSEventQueue.h"
#include "GpAppInterface.h"
#include "SDL.h"
@implementation AerofoilApplication
@@ -10,4 +12,17 @@
SDL_PushEvent(&event);
}
- (void)sendMenuItemEvent:(GpMenuItemSelectionEvent_t)itemEvent {
GpVOSEvent event;
event.m_eventType = GpVOSEventTypes::kMenuItemSelected;
event.m_event.m_menuItemSelectionEvent = itemEvent;
[self sendVOSEvent:event];
}
- (void)sendVOSEvent:(GpVOSEvent)event {
IGpVOSEventQueue* queue = GpAppInterface_Get()->PL_GetDriverCollection()->GetDriver<GpDriverIDs::kEventQueue>();
if (GpVOSEvent *evt = queue->QueueEvent())
*evt = event;
}
@end