Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 8, 2007, 5:37:26 PM (16 years ago)
Author:
landauf
Message:

added a config-file-parser and a makro ( SetConfigValue(variable, defaultvalue) ) to get user-modified values from the config-file (or to write the defaultvalue into it if the variable isn't yet in the file).

Location:
code/branches/objecthierarchy/src/orxonox/objects
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/Tickable.h

    r375 r434  
    33
    44#include "../core/IdentifierIncludes.h"
    5 #include "Ogre.h"
     5#include "OgreFrameListener.h"
    66
    77namespace orxonox
  • code/branches/objecthierarchy/src/orxonox/objects/Timer.h

    r375 r434  
    33
    44#include "../core/IdentifierIncludes.h"
    5 #include "Ogre.h"
     5#include "OgreFrameListener.h"
    66
    77namespace orxonox
  • code/branches/objecthierarchy/src/orxonox/objects/test3.cc

    r383 r434  
    1010    {
    1111        RegisterObject(Test3);
     12
     13        this->setConfigValues();
     14    }
     15
     16    void Test3::setConfigValues()
     17    {
     18        SetConfigValue(value_int_, -100);
     19        SetConfigValue(value_double_, 10.555678);
     20        SetConfigValue(value_bool_, true);
     21        SetConfigValue(value_string_, "Dies ist ein Test");
     22        SetConfigValue(value_vector3_, Vector3(13, 26, 39));
     23        SetConfigValue(value_colourvalue_, ColourValue(1.0, 0.5, 0.25, 0.887));
    1224    }
    1325
     
    1527    {
    1628    }
     29
     30    void Test3::configOutput()
     31    {
     32        std::cout << this->value_int_ << std::endl;
     33        std::cout << this->value_double_ << std::endl;
     34        std::cout << this->value_bool_ << std::endl;
     35        std::cout << this->value_string_ << std::endl;
     36        std::cout << this->value_vector3_ << std::endl;
     37        std::cout << this->value_colourvalue_ << std::endl;
     38    }
     39
    1740        #define testandcout(code) \
    1841          std::cout << #code << " " << code << "\n"
  • code/branches/objecthierarchy/src/orxonox/objects/test3.h

    r383 r434  
    1515            virtual ~Test3();
    1616
     17            void setConfigValues();
     18
    1719            void usefullClassesIsATest(Test1* test1);
    1820            void usefullClassesIsATest(Test2* test2);
     21
     22            void configOutput();
     23
     24        private:
     25            int                 value_int_;
     26            double              value_double_;
     27            bool                value_bool_;
     28            std::string         value_string_;
     29            Vector3             value_vector3_;
     30            ColourValue         value_colourvalue_;
    1931    };
    2032}
Note: See TracChangeset for help on using the changeset viewer.