refs #298, implemented isPaused for FSX

In the same step renamed enum SystemEvent values to make them easier to spot
This commit is contained in:
Klaus Basan
2014-07-12 18:25:29 +02:00
parent 284a66a65c
commit 8d20c5e061
3 changed files with 25 additions and 16 deletions

View File

@@ -426,17 +426,20 @@ namespace BlackSimPlugin
HRESULT CSimulatorFsx::initEvents()
{
HRESULT hr = S_OK;
// System events
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, EventSimStatus, "Sim");
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, EventObjectAdded, "ObjectAdded");
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, EventObjectRemoved, "ObjectRemoved");
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, EventFrame, "Frame");
// System events, see http://msdn.microsoft.com/en-us/library/cc526983.aspx#SimConnect_SubscribeToSystemEvent
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, SystemEventSimStatus, "Sim");
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, SystemEventObjectAdded, "ObjectAdded");
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, SystemEventObjectRemoved, "ObjectRemoved");
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, SystemEventFrame, "Frame");
hr += SimConnect_SubscribeToSystemEvent(m_hSimConnect, SystemEventPause, "Pause");
if (hr != S_OK)
{
qFatal("SimConnect_SubscribeToSystemEvent failed");
}
// Mapped events
// Mapped events, see event ids here: http://msdn.microsoft.com/en-us/library/cc526980.aspx
hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventPauseToggle, "PAUSE_TOGGLE");
hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, SystemEventSlewToggle, "SLEW_TOGGLE");
hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventFreezeLat, "FREEZE_LATITUDE_LONGITUDE_SET");
hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventFreezeAlt, "FREEZE_ALTITUDE_SET");
hr += SimConnect_MapClientEventToSimEvent(m_hSimConnect, EventFreezeAtt, "FREEZE_ATTITUDE_SET");

View File

@@ -51,11 +51,13 @@ namespace BlackSimPlugin
//! SimConnect Event IDs
enum EventIds
{
EventSimStatus,
EventObjectAdded,
EventObjectRemoved,
EventSlewOn,
EventFrame,
SystemEventSimStatus,
SystemEventObjectAdded,
SystemEventObjectRemoved,
SystemEventSlewToggle,
SystemEventFrame,
SystemEventPause,
EventPauseToggle,
EventFreezeLat,
EventFreezeAlt,
EventFreezeAtt,

View File

@@ -62,7 +62,7 @@ namespace BlackSimPlugin
switch (event->uEventID)
{
case EventSimStatus:
case SystemEventSimStatus:
{
if (event->dwData)
{
@@ -74,17 +74,21 @@ namespace BlackSimPlugin
}
break;
}
case SystemEventPause:
{
simulatorFsx->m_simPaused = event->dwData ? true : false;
break;
}
}
break;
}
case SIMCONNECT_RECV_ID_EVENT_OBJECT_ADDREMOVE:
{
SIMCONNECT_RECV_EVENT_OBJECT_ADDREMOVE *event = static_cast<SIMCONNECT_RECV_EVENT_OBJECT_ADDREMOVE *>(pData);
if (event->uEventID == EventObjectAdded)
if (event->uEventID == SystemEventObjectAdded)
{
}
else if (event->uEventID == EventObjectRemoved)
else if (event->uEventID == SystemEventObjectRemoved)
{
}
break;
@@ -94,7 +98,7 @@ namespace BlackSimPlugin
SIMCONNECT_RECV_EVENT_FRAME *event = (SIMCONNECT_RECV_EVENT_FRAME *) pData;
switch (event->uEventID)
{
case EventFrame:
case SystemEventFrame:
simulatorFsx->onSimFrame();
break;
default: