VRTowerDef/Plugins/MetaXR/Source/OculusXRScene/Private/OculusXRSceneEventHandling.cpp

39 lines
883 B
C++
Raw Normal View History

2024-05-29 08:53:41 +00:00
// Copyright (c) Meta Platforms, Inc. and affiliates.
#include "OculusXRSceneEventHandling.h"
#include "OculusXRHMD.h"
#include "IOculusXRSceneModule.h"
#include "OculusXRSceneDelegates.h"
#include "OculusXRSceneEventDelegates.h"
namespace OculusXRScene
{
template <typename T>
void GetEventData(ovrpEventDataBuffer& Buffer, T& OutEventData)
{
unsigned char* BufData = Buffer.EventData;
BufData -= sizeof(Buffer.EventType); // Offset buffer data to get to the actual event payload
memcpy(&OutEventData, BufData, sizeof(T));
}
void FOculusXRSceneEventHandling::OnPollEvent(ovrpEventDataBuffer* EventDataBuffer, bool& EventPollResult)
{
ovrpEventDataBuffer& buf = *EventDataBuffer;
EventPollResult = true;
switch (buf.EventType)
{
case ovrpEventType_None:
default:
{
EventPollResult = false;
break;
}
}
}
} // namespace OculusXRScene