Revision: 2384
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2384&view=rev
Author:   rorthomas
Date:     2012-01-29 20:52:02 +0000 (Sun, 29 Jan 2012)
Log Message:
-----------
improved dashboards a bit

Modified Paths:
--------------
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/gui/DashBoardManager.cpp
    trunk/source/main/gui/DashBoardManager.h
    trunk/source/main/physics/Beam.cpp

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-01-29 15:45:26 UTC 
(rev 2383)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-01-29 20:52:02 UTC 
(rev 2384)
@@ -5247,6 +5247,26 @@
        }
 #endif //MYGUI
 
+#if 0
+       // put some trucks in a fancy circle
+       // not functional purpose, just for screenshots
+       {
+               float dg = 0, rad = 10;
+               for(int i=0;i < 200; i++)
+               {
+                       dg += (Ogre::Math::PI * 2) / (10+rad);
+                       rad += 0.4f;
+                       if(dg > 2 * Ogre::Math::PI)
+                       {
+                               //rad += 10;
+                               dg -= 2 * Ogre::Math::PI;
+                       }
+                       Vector3 pos(cx + cos(dg) * rad, cy, cz + sin(dg) * rad);
+                       BeamFactory::getSingleton().createLocal(pos, 
Quaternion(Radian(-dg), Vector3::UNIT_Y), "semi.truck");
+               }
+               BeamFactory::getSingleton().sendAllTrucksSleeping();
+       }
+#endif // 0
 
        collisions->finishLoadingTerrain();
 

Modified: trunk/source/main/gui/DashBoardManager.cpp
===================================================================
--- trunk/source/main/gui/DashBoardManager.cpp  2012-01-29 15:45:26 UTC (rev 
2383)
+++ trunk/source/main/gui/DashBoardManager.cpp  2012-01-29 20:52:02 UTC (rev 
2384)
@@ -195,12 +195,14 @@
 
 // DASHBOARD class below
 
-DashBoard::DashBoard(DashBoardManager *manager, Ogre::String filename, bool 
_textureLayer) : manager(manager), filename(filename), free_controls(0), 
visible(false), mainWidget(0), textureLayer(_textureLayer)
+DashBoard::DashBoard(DashBoardManager *manager, Ogre::String filename, bool 
_textureLayer) : manager(manager), filename(filename), free_controls(0), 
visible(false), mainWidget(nullptr), textureLayer(_textureLayer)
 {
        // use 'this' class pointer to make layout unique
        prefix = MyGUI::utility::toString(this, "_");
        memset(&controls, 0, sizeof(controls));
        loadLayout(filename);
+       // hide first
+       if(mainWidget) mainWidget->setVisible(false);
 }
 
 DashBoard::~DashBoard()
@@ -313,7 +315,7 @@
                        else if(controls[i].direction == DIRECTION_RIGHT)
                                
controls[i].widget->setPosition(controls[i].initialPosition.left + translation, 
controls[i].initialPosition.top);
                }
-               else if(controls[i].animationType == ANIM_TEXT)
+               else if(controls[i].animationType == ANIM_TEXTFORMAT)
                {
                        float val = manager->getNumeric(controls[i].linkID);
 
@@ -333,7 +335,7 @@
 
                        controls[i].txt->setCaption(s);
                }
-               else if(controls[i].animationType == ANIM_TEXT2)
+               else if(controls[i].animationType == ANIM_TEXTSTRING)
                {
                        char *val = manager->getChar(controls[i].linkID);
                        controls[i].txt->setCaption(MyGUI::UString(val));
@@ -379,7 +381,7 @@
                std::string prefixLessName = name.substr(prefix.size());
                if(prefixLessName == "_Main")
                {
-                       mainWidget = w;
+                       mainWidget = (MyGUI::WindowPtr)w;
                        // resize it
                        windowResized();
                }
@@ -548,11 +550,26 @@
                                return;
                        }
                }
-               else if(anim == "text")
+               else if(anim == "textcolor" || anim == "textcolour")
                {
+                       ctrl.animationType = ANIM_TEXTCOLOR;
+
                        // try to cast, will throw
                        try
                        {
+                               ctrl.txt = (MyGUI::TextBox *)w;
+                       }
+                       catch (...)
+                       {
+                               LOG("Dashboard ("+filename+"/"+name+"): 
textcolor controls must use the TextBox Control");
+                               return;
+                       }
+               }
+               else if(anim == "textformat")
+               {
+                       // try to cast, will throw
+                       try
+                       {
                                ctrl.txt = (MyGUI::TextBox *)w; // 
w->getSubWidgetMain()->castType<MyGUI::TextBox>();
                        }
                        catch (...)
@@ -560,9 +577,9 @@
                                LOG("Dashboard ("+filename+"/"+name+"): Lamp 
controls must use the ImageBox Control");
                                return;
                        }
-                       ctrl.animationType = ANIM_TEXT;
+                       ctrl.animationType = ANIM_TEXTFORMAT;
                }
-               else if(anim == "text2")
+               else if(anim == "textstring")
                {
                        // try to cast, will throw
                        try
@@ -574,7 +591,7 @@
                                LOG("Dashboard ("+filename+"/"+name+"): Lamp 
controls must use the ImageBox Control");
                                return;
                        }
-                       ctrl.animationType = ANIM_TEXT2;
+                       ctrl.animationType = ANIM_TEXTSTRING;
                }
                else if(anim == "lamp")
                {
@@ -636,7 +653,7 @@
 void DashBoard::setVisible(bool v)
 {
        visible = v;
-       if(mainWidget) mainWidget->setVisible(v);
+       if(mainWidget) mainWidget->setVisibleSmooth(v);
 }
 
 #endif // USE_MYGUI

Modified: trunk/source/main/gui/DashBoardManager.h
===================================================================
--- trunk/source/main/gui/DashBoardManager.h    2012-01-29 15:45:26 UTC (rev 
2383)
+++ trunk/source/main/gui/DashBoardManager.h    2012-01-29 20:52:02 UTC (rev 
2384)
@@ -218,11 +218,11 @@
        DashBoardManager *manager;
        Ogre::String filename;
        MyGUI::VectorWidgetPtr widgets;
-       MyGUI::WidgetPtr mainWidget;
+       MyGUI::WindowPtr mainWidget;
        bool visible, textureLayer;
        std::string prefix;
 
-       enum {ANIM_NONE,      ANIM_ROTATE, ANIM_SCALE, ANIM_TEXT, ANIM_TEXT2, 
ANIM_LAMP, ANIM_SERIES, ANIM_TRANSLATE };
+       enum {ANIM_NONE,      ANIM_ROTATE, ANIM_SCALE, ANIM_TEXTFORMAT, 
ANIM_TEXTSTRING, ANIM_LAMP, ANIM_SERIES, ANIM_TRANSLATE, ANIM_TEXTCOLOR };
        enum {DIRECTION_NONE, DIRECTION_UP, DIRECTION_RIGHT, DIRECTION_DOWN, 
DIRECTION_LEFT };
        enum {CONDITION_NONE, CONDITION_GREATER, CONDITION_LESSER};
 

Modified: trunk/source/main/physics/Beam.cpp
===================================================================
--- trunk/source/main/physics/Beam.cpp  2012-01-29 15:45:26 UTC (rev 2383)
+++ trunk/source/main/physics/Beam.cpp  2012-01-29 20:52:02 UTC (rev 2384)
@@ -5533,7 +5533,7 @@
                } else
                {
                        // load all dashs
-                       for(int i=0; i < dashBoardLayouts.size(); i++)
+                       for(unsigned int i=0; i < dashBoardLayouts.size(); i++)
                                dash->loadDashBoard(dashBoardLayouts[i].first, 
dashBoardLayouts[i].second);
                }
                dash->setVisible(false);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to