mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Parametrized position of xbus text message box.
This commit is contained in:
@@ -19,13 +19,6 @@
|
||||
namespace XBus
|
||||
{
|
||||
|
||||
|
||||
const int c_screenWidth = 1024;
|
||||
const int c_screenHeight = 768;
|
||||
const int c_boxLeft = 128;
|
||||
const int c_boxTop = c_screenHeight - 16;
|
||||
const int c_boxRight = c_screenWidth - 128;
|
||||
|
||||
void CMessageBox::draw()
|
||||
{
|
||||
const int messageCount = static_cast<int>(m_messages.size());
|
||||
@@ -75,7 +68,8 @@ namespace XBus
|
||||
return len;
|
||||
}
|
||||
|
||||
CMessageBoxControl::CMessageBoxControl() :
|
||||
CMessageBoxControl::CMessageBoxControl(int left, int right, int top) :
|
||||
m_messageBox(left, right, top),
|
||||
m_showCommand("org/swift-project/xbus/show_messages", "Show XBus text messages", [this] { show(); }),
|
||||
m_hideCommand("org/swift-project/xbus/hide_messages", "Hide XBus text messages", [this] { hide(); }),
|
||||
m_toggleCommand("org/swift-project/xbus/toggle_messages", "Toggle XBus text messages", [this] { toggle(); }),
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace XBus
|
||||
struct CMessage
|
||||
{
|
||||
//! Constructor.
|
||||
CMessage(const std::string &text, float r, float g, float b) : m_text(text), m_rgb{{ r, g, b }} {}
|
||||
CMessage(const std::string &text, float r = 1, float g = 1, float b = 1) : m_text(text), m_rgb{{ r, g, b }} {}
|
||||
|
||||
//! Text.
|
||||
std::string m_text;
|
||||
@@ -44,7 +44,11 @@ namespace XBus
|
||||
{
|
||||
public:
|
||||
//! Constructor.
|
||||
CMessageBox() : CDrawable(xplm_Phase_Window, true) {}
|
||||
//! \param left Number of "virtual pixels" between screen left edge and box left edge.
|
||||
//! \param right Number of "virtual pixels" between screen right edge and box right edge.
|
||||
//! \param top Number of "virtual pixels" between screen top edge and box top edge.
|
||||
CMessageBox(int left, int right, int top) : CDrawable(xplm_Phase_Window, true),
|
||||
c_boxLeft(left), c_boxRight(c_screenWidth - right), c_boxTop(c_screenHeight - top) {}
|
||||
|
||||
//! Set messages to draw in message box, from a pair of iterators.
|
||||
template <typename Iterator>
|
||||
@@ -71,6 +75,11 @@ namespace XBus
|
||||
std::vector<CMessage> m_messages;
|
||||
bool m_upArrow = false;
|
||||
bool m_downArrow = false;
|
||||
const int c_boxLeft = 0;
|
||||
const int c_boxRight = 0;
|
||||
const int c_boxTop = 0;
|
||||
constexpr static int c_screenWidth = 1024;
|
||||
constexpr static int c_screenHeight = 768;
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -79,8 +88,8 @@ namespace XBus
|
||||
class CMessageBoxControl
|
||||
{
|
||||
public:
|
||||
//! Constructor.
|
||||
CMessageBoxControl();
|
||||
//! \copydoc CMessageBox::CMessageBox
|
||||
CMessageBoxControl(int left, int right, int top);
|
||||
|
||||
//! Add a new message to the bottom of the list.
|
||||
void addMessage(const CMessage &message);
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace XBus
|
||||
double getSpeedBrakeRatio() const { return m_speedBrakeRatio.get(); }
|
||||
|
||||
private:
|
||||
CMessageBoxControl m_messages;
|
||||
CMessageBoxControl m_messages { 128, 128, 16 };
|
||||
BlackMisc::Simulation::XPlane::CNavDataReferenceList m_airports;
|
||||
QTimer *m_airportUpdater = nullptr;
|
||||
void readAirportsDatabase();
|
||||
|
||||
Reference in New Issue
Block a user