mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
[xswiftbus] display FPS in simulator data window
* added driver getAverageFPS function * display in simulator component
This commit is contained in:
committed by
Mat Sutcliffe
parent
548a12a502
commit
72c3abb1e7
@@ -236,6 +236,8 @@ namespace BlackSimPlugin
|
||||
{
|
||||
if (this->isConnected())
|
||||
{
|
||||
m_fastTimerCalls++;
|
||||
|
||||
m_serviceProxy->getOwnAircraftSituationDataAsync(&m_xplaneData);
|
||||
m_serviceProxy->getOwnAircraftCom1DataAsync(&m_xplaneData);
|
||||
m_serviceProxy->getOwnAircraftCom2DataAsync(&m_xplaneData);
|
||||
@@ -313,6 +315,8 @@ namespace BlackSimPlugin
|
||||
{
|
||||
if (isConnected())
|
||||
{
|
||||
m_slowTimerCalls++;
|
||||
|
||||
// own aircraft data
|
||||
m_serviceProxy->getOwnAircraftModelDataAsync(&m_xplaneData);
|
||||
m_serviceProxy->getOwnAircraftLightsAsync(&m_xplaneData);
|
||||
@@ -360,6 +364,13 @@ namespace BlackSimPlugin
|
||||
{
|
||||
this->triggerRemoveAircraft(cs, ++i * 100);
|
||||
}
|
||||
|
||||
// FPS
|
||||
if ((m_slowTimerCalls % 5) == 0)
|
||||
{
|
||||
// reading FPS resets average, so we only monitor over some time
|
||||
m_averageFps = m_serviceProxy->getAverageFPS();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,6 +446,9 @@ namespace BlackSimPlugin
|
||||
m_serviceProxy = nullptr;
|
||||
m_trafficProxy = nullptr;
|
||||
m_weatherProxy = nullptr;
|
||||
m_fastTimerCalls = 0;
|
||||
m_slowTimerCalls = 0;
|
||||
|
||||
this->emitSimulatorCombinedStatus();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -250,6 +250,9 @@ namespace BlackSimPlugin
|
||||
QTimer m_slowTimer;
|
||||
QTimer m_airportUpdater;
|
||||
QTimer m_pendingAddedTimer;
|
||||
int m_fastTimerCalls = 0; //!< how often called
|
||||
int m_slowTimerCalls = 0; //!< how often called
|
||||
|
||||
BlackMisc::Aviation::CAirportList m_airportsInRange; //!< aiports in range of own aircraft
|
||||
BlackMisc::Simulation::CSimulatedAircraftList m_pendingToBeAddedAircraft; //!< aircraft to be added
|
||||
QHash<BlackMisc::Aviation::CCallsign, qint64> m_addingInProgressAircraft; //!< aircraft just adding
|
||||
|
||||
Reference in New Issue
Block a user