]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/ATCdisplay.cxx
Ima Sudonim:
[flightgear.git] / src / ATC / ATCdisplay.cxx
index 4f75c489e5736d268529c310b335c547a6ab712d..0b3fa2a7f2b791ca781ccd94dd5fac7807f51e44 100644 (file)
 #  include <config.h>
 #endif
 
+#ifdef HAVE_WINDOWS_H
+#   include <windows.h>
+#endif
+
+#include <simgear/compiler.h>
+
+#include SG_GLU_H
+
 #include <simgear/props/props.hxx>
 
 #include <Include/general.hxx>
@@ -35,8 +43,8 @@
 FGATCDisplay::FGATCDisplay() {
        rep_msg = false;
        change_msg_flag = false;
-       dsp_offset1 = 0;
-       dsp_offset2 = 0;
+       dsp_offset1 = 0.0;
+       dsp_offset2 = 0.0;
 }
 
 
@@ -168,10 +176,10 @@ void FGATCDisplay::update(double dt) {
                                                //cout << "Stopping single message\n";
                                                msgList_itr = msgList.erase(msgList_itr);
                                        } else if(m.counter > m.start_count) {
-                                               guiFnt.drawString( m.msg.c_str(),
-                                               (iwidth - (m.msg.size() * 8))/2,
-                                               //iwidth/2,
-                                               (iheight - 40) );       // TODO - relate the distance in that the string is rendered to the string length.
+                                               int pin = (((int)m.msg.size() * 8) >= iwidth ? 5 : (iwidth - (m.msg.size() * 8))/2);
+                                               //cout << m.msg << '\n';
+                                               //cout << "pin = " << pin << ", iwidth = " << iwidth << ", msg.size = " << m.msg.size() << '\n';
+                                               guiFnt.drawString( m.msg.c_str(), pin, (iheight - 40) );
                                                m.counter += dt;
                                                msgList[i] = m;
                                                ++msgList_itr;
@@ -195,6 +203,7 @@ void FGATCDisplay::update(double dt) {
 }
 
 void FGATCDisplay::RegisterSingleMessage(string msg, double delay) {
+       //cout << msg << '\n';
        atcMessage m;
        m.msg = msg;
        m.repeating = false;