mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
This commit is contained in:
@@ -569,7 +569,8 @@ namespace BlackSimPlugin
|
||||
if (isInFunction) { return; }
|
||||
isInFunction = true;
|
||||
|
||||
QColor color = "cyan";
|
||||
std::vector<int> msgBoxValues = m_xSwiftBusServerSettings.getThreadLocal().getMessageBoxValuesVector();
|
||||
QColor color = msgBoxValues[9];
|
||||
/* switch (message.getSeverity())
|
||||
{
|
||||
case CStatusMessage::SeverityDebug: color = "teal"; break;
|
||||
@@ -587,11 +588,12 @@ namespace BlackSimPlugin
|
||||
// avoid issues during shutdown
|
||||
if (this->isShuttingDownOrDisconnected()) { return; }
|
||||
|
||||
std::vector<int> msgBoxValues = m_xSwiftBusServerSettings.getThreadLocal().getMessageBoxValuesVector();
|
||||
QColor color;
|
||||
if (message.isServerMessage()) { color = "orchid"; }
|
||||
else if (message.isSupervisorMessage()) { color = "yellow"; }
|
||||
else if (message.isPrivateMessage()) { color = "magenta"; }
|
||||
else { color = "lime"; }
|
||||
if (message.isServerMessage()) { color = msgBoxValues[8]; }
|
||||
else if (message.isSupervisorMessage()) { color = msgBoxValues[10]; }
|
||||
else if (message.isPrivateMessage()) { color = msgBoxValues[7]; }
|
||||
else { color = msgBoxValues[6]; }
|
||||
|
||||
m_serviceProxy->addTextMessage(message.getSenderCallsign().toQString() + ": " + message.getMessage(), color.redF(), color.greenF(), color.blueF());
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace XSwiftBus
|
||||
XPMPSetDefaultPlaneICAO(defaultIcao.c_str());
|
||||
}
|
||||
|
||||
void CTraffic::setDrawingLabels(bool drawing)
|
||||
void CTraffic::setDrawingLabels(bool drawing, int rgb)
|
||||
{
|
||||
CSettings s = this->getSettings();
|
||||
if (s.isDrawingLabels() != drawing)
|
||||
@@ -269,7 +269,10 @@ namespace XSwiftBus
|
||||
s.setDrawingLabels(drawing);
|
||||
this->setSettings(s);
|
||||
}
|
||||
|
||||
if (rgb >= 0)
|
||||
{
|
||||
m_labels.setColor((rgb & 0xff0000) >> 16, (rgb & 0x00ff00) >> 8, rgb & 0x0000ff);
|
||||
}
|
||||
if (drawing)
|
||||
{
|
||||
m_labels.show();
|
||||
@@ -828,7 +831,7 @@ namespace XSwiftBus
|
||||
{
|
||||
invokeQueuedDBusCalls();
|
||||
doPlaneUpdates();
|
||||
setDrawingLabels(getSettings().isDrawingLabels());
|
||||
setDrawingLabels(getSettings().isDrawingLabels(), getSettings().getLabelColor());
|
||||
emitSimFrame();
|
||||
m_countFrame++;
|
||||
return 1;
|
||||
@@ -901,7 +904,6 @@ namespace XSwiftBus
|
||||
{
|
||||
static const double maxRangeM = 10000;
|
||||
static const double metersPerFt = 0.3048;
|
||||
static float color[3]{ 1.0f, 0.75f, 0.0f };
|
||||
std::array<float, 16> worldMat = m_worldMat.getAll();
|
||||
std::array<float, 16> projMat = m_projMat.getAll();
|
||||
double windowWidth = static_cast<double>(m_windowWidth.get());
|
||||
@@ -931,7 +933,7 @@ namespace XSwiftBus
|
||||
{
|
||||
continue; // plane is behind camera
|
||||
}
|
||||
XPLMDrawString(color,
|
||||
XPLMDrawString(m_color.data(),
|
||||
static_cast<int>(std::lround(windowWidth * (windowPos[0] * 0.5 + 0.5))),
|
||||
static_cast<int>(std::lround(windowHeight * (windowPos[1] * 0.5 + 0.5))),
|
||||
text, nullptr, xplmFont_Basic);
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace XSwiftBus
|
||||
void setDefaultIcao(const std::string &defaultIcao);
|
||||
|
||||
//! Set whether the plugin draws type and callsign labels above aircraft
|
||||
void setDrawingLabels(bool drawing);
|
||||
void setDrawingLabels(bool drawing, int rgb = -1);
|
||||
|
||||
//! Get whether the plugin draws type and callsign labels above aircraft
|
||||
bool isDrawingLabels() const;
|
||||
@@ -194,12 +194,14 @@ namespace XSwiftBus
|
||||
{
|
||||
public:
|
||||
Labels(CTraffic *traffic) : CDrawable(xplm_Phase_Window, false), m_traffic(traffic) {}
|
||||
void setColor(int r, int g, int b) { m_color = {{ static_cast<float>(r) / 255.f, static_cast<float>(g) / 255.f, static_cast<float>(b) / 255.f }}; }
|
||||
protected:
|
||||
virtual void draw() override;
|
||||
private:
|
||||
static void matrixMultVec(double out[4], const float m[16], const double v[4]);
|
||||
double distanceSquared(const double pos[3]) const;
|
||||
CTraffic *m_traffic = nullptr;
|
||||
std::array<float, 3> m_color{{ 1.0f, 0.75f, 0.0f }};
|
||||
ArrayDataRef<xplane::data::sim::graphics::view::world_matrix> m_worldMat;
|
||||
ArrayDataRef<xplane::data::sim::graphics::view::projection_matrix_3d> m_projMat;
|
||||
DataRef<xplane::data::sim::graphics::view::window_width> m_windowWidth;
|
||||
|
||||
Reference in New Issue
Block a user