Changeset 4241 in orxonox.OLD for orxonox/branches
- Timestamp:
- May 20, 2005, 3:45:55 AM (20 years ago)
- Location:
- orxonox/branches/levelLoader/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelLoader/src/glmenu/glmenu_imagescreen.cc
r4239 r4241 60 60 const char* string; 61 61 62 // Model Loading 63 string = grabParameter( root, "BackgroundImage"); 64 if( string != NULL) 65 this->setBackgroundImage(string); 66 67 string = grabParameter(root, "BackgroundPS"); 68 if (string != NULL) 69 { 70 float f1, f2, f3, f4; 71 sscanf (string, "%f %f %f %f", &f1, &f2, &f3, &f4); 72 this->setPosition(f1,f2); 73 this->setScale(f3,f4); 74 } 75 76 string = grabParameter( root, "BarImage"); 77 if (string != NULL) 78 this->setBarImage(string); 79 string = grabParameter(root, "BarPS"); 80 if (string != NULL) 81 { 82 float f1, f2, f3, f4; 83 sscanf (string, "%f %f %f %f", &f1, &f2, &f3, &f4); 84 this->setBarPosScale(f1,f2,f3,f4); 85 } 86 87 string = grabParameter( root, "ElementCount"); 88 if (string != NULL) 89 this->setMaximum(atoi(string)); 62 LoadParam<GLMenuImageScreen>(root, "BackgroundImage", this, &GLMenuImageScreen::setBackgroundImage); 63 64 LoadParam<GLMenuImageScreen>(root, "BackgroundPS", this, &GLMenuImageScreen::setPosScale); 65 66 LoadParam<GLMenuImageScreen>(root, "BarImage", this, &GLMenuImageScreen::setBarImage); 67 68 LoadParam<GLMenuImageScreen>(root, "BarPS", this, &GLMenuImageScreen::setBarPosScale); 69 70 LoadParam<GLMenuImageScreen>(root, "ElementCount", this, &GLMenuImageScreen::setMaximum); 90 71 } 91 72 … … 149 130 this->scaleX = scaleX; 150 131 this->scaleY = scaleY; 132 } 133 134 /* 135 \brief sets position and size of the ImageScreen 136 \param x offset from the top left corner in percent(0-1) of the screensize 137 \param y offset from the top left corner in percent(0-1) of the screensize 138 \param scaleX the scaleing of the image into the x-direction (in percent (0-1)) 139 \param scaleY the scaleing of the image into the y-direction (in percent (0-1)) 140 */ 141 void GLMenuImageScreen::setPosScale(float offsetX, float offsetY, float scaleX, float scaleY) 142 { 143 this->setPosition(offsetX, offsetY); 144 this->setScale(scaleX, scaleY); 151 145 } 152 146 -
orxonox/branches/levelLoader/src/glmenu/glmenu_imagescreen.h
r4104 r4241 28 28 void setPosition(float offsetX, float offsetY); 29 29 void setScale (float scaleX, float scaleY); 30 void setPosScale(float offsetX, float offsetY, float scaleX, float scaleY); 30 31 31 32 void setBarImage(const char* barImage); -
orxonox/branches/levelLoader/src/util/loading/load_param.h
r4239 r4241 5 5 #include "factory.h" 6 6 #include "debug.h" 7 #include "substring.h" 7 8 8 9 // abstract base class … … 18 19 { 19 20 public: 21 // CONST CHAR* 20 22 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(const char*)) 21 23 { … … 28 30 }; 29 31 32 // 1. FLOAT 30 33 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(float)) 34 { 35 const char* loadString = grabParameter(root, paramName); 36 if (loadString != NULL) 37 (*pt2Object.*function)(atof(loadString)); 38 else 39 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 40 }; 41 42 // 2. FLOAT 43 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(float, float)) 44 { 45 const char* loadString = grabParameter(root, paramName); 46 if (loadString != NULL) 47 { 48 SubString subLoads(loadString); 49 (*pt2Object.*function)(atof(subLoads.getString(0)), atof(subLoads.getString(1))); 50 } 51 else 52 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 53 }; 54 55 // 3. FLOAT 56 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(float, float, float)) 57 { 58 const char* loadString = grabParameter(root, paramName); 59 if (loadString != NULL) 60 { 61 SubString subLoads(loadString); 62 (*pt2Object.*function)(atof(subLoads.getString(0)), atof(subLoads.getString(1)), atof(subLoads.getString(2))); 63 } 64 else 65 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 66 }; 67 68 // 4. FLOAT 69 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(float, float, float, float)) 70 { 71 const char* loadString = grabParameter(root, paramName); 72 if (loadString != NULL) 73 { 74 SubString subLoads(loadString); 75 (*pt2Object.*function)(atof(subLoads.getString(0)), atof(subLoads.getString(1)), atof(subLoads.getString(2)), atof(subLoads.getString(3))); 76 } 77 else 78 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 79 }; 80 81 // 1. INT 82 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(int)) 31 83 { 32 84 const char* loadString = grabParameter(root, paramName); … … 36 88 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 37 89 }; 90 91 // 2. INT 92 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(int, int)) 93 { 94 const char* loadString = grabParameter(root, paramName); 95 if (loadString != NULL) 96 { 97 SubString subLoads(loadString); 98 (*pt2Object.*function)(atoi(subLoads.getString(0)), atoi(subLoads.getString(1))); 99 } 100 else 101 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 102 }; 103 104 // 3. INT 105 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(int, int, int)) 106 { 107 const char* loadString = grabParameter(root, paramName); 108 if (loadString != NULL) 109 { 110 SubString subLoads(loadString); 111 (*pt2Object.*function)(atoi(subLoads.getString(0)), atoi(subLoads.getString(1)), atoi(subLoads.getString(2))); 112 } 113 else 114 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 115 }; 116 117 // 4. INT 118 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(int, int, int, int)) 119 { 120 const char* loadString = grabParameter(root, paramName); 121 if (loadString != NULL) 122 { 123 SubString subLoads(loadString); 124 (*pt2Object.*function)(atoi(subLoads.getString(0)), atoi(subLoads.getString(1)), atoi(subLoads.getString(2)), atoi(subLoads.getString(3))); 125 } 126 else 127 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 128 }; 129 38 130 }; 39 131
Note: See TracChangeset
for help on using the changeset viewer.