Ref T709, update labels every n-th frame

This commit is contained in:
Klaus Basan
2019-07-30 02:18:05 +02:00
committed by Mat Sutcliffe
parent 01f90fc9bf
commit 4a0101feed
2 changed files with 19 additions and 1 deletions

View File

@@ -255,7 +255,13 @@ namespace XSwiftBus
void CTraffic::setDrawingLabels(bool drawing)
{
s_settingsProvider->getSettings().setDrawingLabels(drawing);
CSettings s = this->getSettings();
if (s.isDrawingLabels() != drawing)
{
s.setDrawingLabels(drawing);
this->setSettings(s);
}
if (drawing)
{
XPMPEnableAircraftLabels();
@@ -954,6 +960,17 @@ namespace XSwiftBus
traffic->emitSimFrame();
}
traffic->m_countFrame++;
if (traffic->m_countFrame % 250 == 0)
{
// update labels
const CSettings s = traffic->getSettings();
if (traffic->isDrawingLabels() != s.isDrawingLabels())
{
traffic->setDrawingLabels(s.isDrawingLabels());
}
}
return 1;
}

View File

@@ -210,6 +210,7 @@ namespace XSwiftBus
DeltaCameraPosition m_deltaCameraPosition;
bool m_emitSimFrame = true;
int m_countFrame = 0; //!< allows to do something every n-th frame
int getPlaneData(void *id, int dataType, void *io_data);
static int getPlaneData(void *id, int dataType, void *io_data, void *self)