Skip to content
Snippets Groups Projects
Commit 118b7985 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Using different EventIDs for different purposes

parent 3142c8a5
Branches
No related tags found
1 merge request!2Backporting many features from the study on top of the Dasher3D-Core
......@@ -60,11 +60,9 @@ FReply SDasherWidget::HandleMouseDownEvent(const FGeometry& Geometry, const FPoi
if(URWTHVRUtilities::IsRoomMountedMode())
{
FDisplayClusterClusterEventBinary ClusterEvent;
ClusterEvent.EventId = DasherEventID;
ClusterEvent.EventData.SetNumUninitialized(1);
ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseDown);
ClusterEvent.EventId = DasherEventID + static_cast<uint8>(DasherEventType::Input_MouseDown);
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false);
UE_LOG(LogTemp, Log, TEXT("MouseDownSend"));
return FReply::Handled().LockMouseToWidget(AsShared());
}
......@@ -84,9 +82,7 @@ FReply SDasherWidget::HandleMouseUpEvent(const FGeometry& Geometry, const FPoint
if(URWTHVRUtilities::IsRoomMountedMode())
{
FDisplayClusterClusterEventBinary ClusterEvent;
ClusterEvent.EventId = DasherEventID;
ClusterEvent.EventData.SetNumUninitialized(1);
ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseUp);
ClusterEvent.EventId = ClusterEvent.EventId = DasherEventID + static_cast<uint8>(DasherEventType::Input_MouseUp);
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false);
return FReply::Handled().ReleaseMouseLock();
}
......@@ -110,9 +106,7 @@ FReply SDasherWidget::HandleMouseDoubleClickEvent(const FGeometry& Geometry, con
if(URWTHVRUtilities::IsRoomMountedMode())
{
FDisplayClusterClusterEventBinary ClusterEvent;
ClusterEvent.EventId = DasherEventID;
ClusterEvent.EventData.SetNumUninitialized(1);
ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Input_MouseDown);
ClusterEvent.EventId = ClusterEvent.EventId = DasherEventID + static_cast<uint8>(DasherEventType::Input_MouseDown);
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false);
return FReply::Handled();
}
......@@ -146,13 +140,12 @@ bool SDasherWidget::GetScreenCoords(screenint& iX, screenint& iY, Dasher::CDashe
void SDasherWidget::HandleClusterEvent(const FDisplayClusterClusterEventBinary& Event)
{
if(Event.EventId != DasherEventID) return;
switch(static_cast<DasherEventType>(Event.EventData[0]))
switch(static_cast<DasherEventType>(Event.EventId - DasherEventID))
{
case DasherEventType::Input_MouseDown:
DasherMainInterface->KeyDown(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Primary_Input);
MouseDownListeners.ExecuteIfBound();
UE_LOG(LogTemp, Log, TEXT("MouseDownReceived"));
break;
case DasherEventType::Input_MouseUp:
DasherMainInterface->KeyUp(FDateTime::Now().GetSecond() + FDateTime::Now().GetMillisecond(), Dasher::Keys::Primary_Input);
......@@ -161,9 +154,9 @@ void SDasherWidget::HandleClusterEvent(const FDisplayClusterClusterEventBinary&
case DasherEventType::Tick:
double currentTime = 0;
FMemory::Memcpy(&currentTime, &Event.EventData[1], sizeof(currentTime));
FMemory::Memcpy(&CursorPosition.x, &Event.EventData[1] + sizeof(currentTime), sizeof(CursorPosition.x));
FMemory::Memcpy(&CursorPosition.y, &Event.EventData[1] + sizeof(currentTime) + sizeof(CursorPosition.x), sizeof(CursorPosition.y));
FMemory::Memcpy(&currentTime, Event.EventData.GetData(), sizeof(currentTime));
FMemory::Memcpy(&CursorPosition.x, Event.EventData.GetData() + sizeof(currentTime), sizeof(CursorPosition.x));
FMemory::Memcpy(&CursorPosition.y, Event.EventData.GetData() + sizeof(currentTime) + sizeof(CursorPosition.x), sizeof(CursorPosition.y));
DasherMainInterface->Tick(static_cast<unsigned long>(currentTime * 1000.0));
break;
......@@ -305,16 +298,13 @@ void SDasherWidget::Tick(const FGeometry& AllottedGeometry, const double InCurre
else
if(URWTHVRUtilities::IsPrimaryNode())
{
UE_LOG(LogTemp, Log, TEXT("EventSend: %d, %d"), CursorPosition.x, CursorPosition.y);
FDisplayClusterClusterEventBinary ClusterEvent;
ClusterEvent.EventId = DasherEventID;
ClusterEvent.EventData.SetNumUninitialized(sizeof(InCurrentTime) + sizeof(CursorPosition.x) + sizeof(CursorPosition.y) + 1);
ClusterEvent.EventId = ClusterEvent.EventId = DasherEventID + static_cast<uint8>(DasherEventType::Tick);
ClusterEvent.EventData.SetNumUninitialized(sizeof(InCurrentTime) + sizeof(CursorPosition.x) + sizeof(CursorPosition.y));
ClusterEvent.EventData[0] = static_cast<uint8>(DasherEventType::Tick);
FMemory::Memcpy(&ClusterEvent.EventData[1], &InCurrentTime, sizeof(InCurrentTime));
FMemory::Memcpy(&ClusterEvent.EventData[1] + sizeof(InCurrentTime), &CursorPosition.x, sizeof(CursorPosition.x));
FMemory::Memcpy(&ClusterEvent.EventData[1] + sizeof(InCurrentTime) + sizeof(CursorPosition.x), &CursorPosition.y, sizeof(CursorPosition.y));
FMemory::Memcpy(ClusterEvent.EventData.GetData(), &InCurrentTime, sizeof(InCurrentTime));
FMemory::Memcpy(ClusterEvent.EventData.GetData() + sizeof(InCurrentTime), &CursorPosition.x, sizeof(CursorPosition.x));
FMemory::Memcpy(ClusterEvent.EventData.GetData() + sizeof(InCurrentTime) + sizeof(CursorPosition.x), &CursorPosition.y, sizeof(CursorPosition.y));
IDisplayCluster::Get().GetClusterMgr()->EmitClusterEventBinary(ClusterEvent, false);
}
......
......@@ -175,7 +175,7 @@ private:
//CAVE Sync
FOnClusterEventBinaryListener ClusterEventListener;
inline static int32 DasherEventID = 424242;
inline static int32 DasherEventID = 424240;
protected:
// stores color information
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment