Changeset 4249 in orxonox.OLD for orxonox/branches/levelLoader/src
- Timestamp:
- May 21, 2005, 10:08:37 PM (20 years ago)
- Location:
- orxonox/branches/levelLoader/src
- Files:
-
- 5 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelLoader/src/Makefile.am
r4239 r4249 48 48 track_manager.cc \ 49 49 track_node.cc \ 50 factory.cc \51 50 util/animation/animation.cc \ 52 51 util/animation/animation3d.cc \ … … 91 90 util/common/list.cc \ 92 91 util/resource_manager.cc \ 92 util/loading/factory.cc \ 93 93 lib/math/vector.cc \ 94 94 lib/math/curve.cc \ … … 153 153 util/common/list_template.h \ 154 154 util/resource_manager.h \ 155 util/loading/factory.h \ 155 156 util/loading/load_param.h \ 156 157 lib/util/ini_parser.h \ -
orxonox/branches/levelLoader/src/Makefile.in
r4239 r4249 76 76 am_orxonox_OBJECTS = orxonox.$(OBJEXT) game_loader.$(OBJEXT) \ 77 77 command_node.$(OBJEXT) keynames.$(OBJEXT) camera.$(OBJEXT) \ 78 track_manager.$(OBJEXT) track_node.$(OBJEXT) factory.$(OBJEXT)\78 track_manager.$(OBJEXT) track_node.$(OBJEXT) \ 79 79 animation.$(OBJEXT) animation3d.$(OBJEXT) \ 80 80 animation_player.$(OBJEXT) garbage_collector.$(OBJEXT) \ … … 93 93 base_entity.$(OBJEXT) base_object.$(OBJEXT) \ 94 94 ini_parser.$(OBJEXT) substring.$(OBJEXT) list.$(OBJEXT) \ 95 resource_manager.$(OBJEXT) vector.$(OBJEXT) curve.$(OBJEXT) \ 96 glmenu_imagescreen.$(OBJEXT) benchmark.$(OBJEXT) 95 resource_manager.$(OBJEXT) factory.$(OBJEXT) vector.$(OBJEXT) \ 96 curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT) \ 97 benchmark.$(OBJEXT) 97 98 orxonox_OBJECTS = $(am_orxonox_OBJECTS) 98 99 am__DEPENDENCIES_1 = … … 298 299 track_manager.cc \ 299 300 track_node.cc \ 300 factory.cc \301 301 util/animation/animation.cc \ 302 302 util/animation/animation3d.cc \ … … 341 341 util/common/list.cc \ 342 342 util/resource_manager.cc \ 343 util/loading/factory.cc \ 343 344 lib/math/vector.cc \ 344 345 lib/math/curve.cc \ … … 403 404 util/common/list_template.h \ 404 405 util/resource_manager.h \ 406 util/loading/factory.h \ 405 407 util/loading/load_param.h \ 406 408 lib/util/ini_parser.h \ … … 1508 1510 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f 'util/resource_manager.cc'; then $(CYGPATH_W) 'util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/util/resource_manager.cc'; fi` 1509 1511 1512 factory.o: util/loading/factory.cc 1513 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT factory.o -MD -MP -MF "$(DEPDIR)/factory.Tpo" -c -o factory.o `test -f 'util/loading/factory.cc' || echo '$(srcdir)/'`util/loading/factory.cc; \ 1514 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/factory.Tpo" "$(DEPDIR)/factory.Po"; else rm -f "$(DEPDIR)/factory.Tpo"; exit 1; fi 1515 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/loading/factory.cc' object='factory.o' libtool=no @AMDEPBACKSLASH@ 1516 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/factory.Po' tmpdepfile='$(DEPDIR)/factory.TPo' @AMDEPBACKSLASH@ 1517 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1518 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o factory.o `test -f 'util/loading/factory.cc' || echo '$(srcdir)/'`util/loading/factory.cc 1519 1520 factory.obj: util/loading/factory.cc 1521 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT factory.obj -MD -MP -MF "$(DEPDIR)/factory.Tpo" -c -o factory.obj `if test -f 'util/loading/factory.cc'; then $(CYGPATH_W) 'util/loading/factory.cc'; else $(CYGPATH_W) '$(srcdir)/util/loading/factory.cc'; fi`; \ 1522 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/factory.Tpo" "$(DEPDIR)/factory.Po"; else rm -f "$(DEPDIR)/factory.Tpo"; exit 1; fi 1523 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/loading/factory.cc' object='factory.obj' libtool=no @AMDEPBACKSLASH@ 1524 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/factory.Po' tmpdepfile='$(DEPDIR)/factory.TPo' @AMDEPBACKSLASH@ 1525 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1526 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o factory.obj `if test -f 'util/loading/factory.cc'; then $(CYGPATH_W) 'util/loading/factory.cc'; else $(CYGPATH_W) '$(srcdir)/util/loading/factory.cc'; fi` 1527 1510 1528 vector.o: lib/math/vector.cc 1511 1529 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vector.o -MD -MP -MF "$(DEPDIR)/vector.Tpo" -c -o vector.o `test -f 'lib/math/vector.cc' || echo '$(srcdir)/'`lib/math/vector.cc; \ -
orxonox/branches/levelLoader/src/util/loading/factory.h
r4248 r4249 22 22 23 23 //! The Factory is 24 /**25 Very philosophic description, huh?26 */27 24 class Factory { 28 25 -
orxonox/branches/levelLoader/src/util/loading/load_param.h
r4243 r4249 7 7 #include "substring.h" 8 8 9 /** 10 useable FunctionParameters are: 11 l_INT: int 12 l_LONG: long 13 l_SHORT: short 14 l_FLOAT: float 15 l_STRING: const char* 16 */ 17 18 #define l_INT_TYPE int 19 #define l_INT_FUNC atoi 20 21 #define l_LONG_TYPE long 22 #define l_LONG_FUNC atol 23 24 #define l_SHORT_TYPE short 25 #define l_SHORT_FUNC atoi 26 27 #define l_FLOAT_TYPE float 28 #define l_FLOAT_FUNC atof 29 30 #define l_STRING_TYPE const char* 31 #define l_STRING_FUNC 32 33 34 /** 35 \brief a Macro to easily implement many different Constructors for the LoadParam-Class 36 \param type1 The type of the first functionParameter 37 */ 38 #define LoadParam1(type1) \ 39 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE)) \ 40 { \ 41 const char* loadString = grabParameter(root, paramName); \ 42 if (loadString != NULL) \ 43 (*pt2Object.*function)(type1##_FUNC(loadString)); \ 44 else \ 45 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 46 } 47 48 49 // 2. TYPES 50 #define LoadParam2(type1, type2)\ 51 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE)) \ 52 { \ 53 const char* loadString = grabParameter(root, paramName); \ 54 if (loadString != NULL) \ 55 { \ 56 SubString subLoads(loadString); \ 57 if (subLoads.getCount() == 2) \ 58 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1))); \ 59 else \ 60 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 61 paramName, pt2Object->getClassName(), 2, subLoads.getCount()); \ 62 } \ 63 else \ 64 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 65 }; 66 67 68 // 3. TYPES 69 #define LoadParam3(type1, type2, type3)\ 70 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE)) \ 71 { \ 72 const char* loadString = grabParameter(root, paramName); \ 73 if (loadString != NULL) \ 74 { \ 75 SubString subLoads(loadString); \ 76 if (subLoads.getCount() == 3) \ 77 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2))); \ 78 else \ 79 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 80 paramName, pt2Object->getClassName(), 3, subLoads.getCount()); \ 81 } \ 82 else \ 83 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 84 }; 85 86 87 // 4. TYPES 88 #define LoadParam4(type1, type2, type3, type4)\ 89 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE)) \ 90 { \ 91 const char* loadString = grabParameter(root, paramName); \ 92 if (loadString != NULL) \ 93 { \ 94 SubString subLoads(loadString); \ 95 if (subLoads.getCount() == 4) \ 96 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3))); \ 97 else \ 98 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 99 paramName, pt2Object->getClassName(), 4, subLoads.getCount()); \ 100 } \ 101 else \ 102 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 103 }; 104 9 105 // abstract base class 10 106 class baseLoadParam 11 107 { 12 108 public: 13 // virtual void Call(const char* string)=0; // call using function109 void description(const char* description); 14 110 }; 15 111 … … 19 115 { 20 116 public: 21 // 1. CONST CHAR* 22 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(const char*)) 23 { 24 const char* loadString = grabParameter(root, paramName); 25 if (loadString != NULL) 26 (*pt2Object.*function)(loadString); 27 else 28 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 29 }; 117 LoadParam1(l_STRING); 118 LoadParam2(l_STRING, l_STRING); 119 LoadParam3(l_STRING, l_STRING, l_STRING); 120 LoadParam4(l_STRING, l_STRING, l_STRING, l_STRING); 30 121 31 // 2. CONST CHAR* 32 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(const char*, const char*)) 33 { 34 const char* loadString = grabParameter(root, paramName); 35 if (loadString != NULL) 36 { 37 SubString subLoads(loadString); 38 if (subLoads.getCount() == 2) 39 (*pt2Object.*function)(subLoads.getString(0), subLoads.getString(1)); 40 else 41 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", 42 paramName, pt2Object->getClassName(), 2, subLoads.getCount()); 43 } 44 else 45 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 46 }; 122 LoadParam1(l_INT); 123 LoadParam2(l_INT, l_INT); 124 LoadParam3(l_INT, l_INT, l_INT); 125 LoadParam4(l_INT, l_INT, l_INT, l_INT); 47 126 48 // 3. CONST CHAR* 49 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(const char*, const char*, const char*)) 50 { 51 const char* loadString = grabParameter(root, paramName); 52 if (loadString != NULL) 53 { 54 SubString subLoads(loadString); 55 if (subLoads.getCount() == 3) 56 (*pt2Object.*function)(subLoads.getString(0), subLoads.getString(1), subLoads.getString(2)); 57 else 58 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", 59 paramName, pt2Object->getClassName(), 3, subLoads.getCount()); 60 } 61 else 62 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 63 }; 127 LoadParam1(l_FLOAT); 128 LoadParam2(l_FLOAT, l_FLOAT); 129 LoadParam3(l_FLOAT, l_FLOAT, l_FLOAT); 130 LoadParam4(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT); 64 131 65 // 4. CONST CHAR*66 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(const char*, const char*, const char*, const char*))67 {68 const char* loadString = grabParameter(root, paramName);69 if (loadString != NULL)70 {71 SubString subLoads(loadString);72 if (subLoads.getCount() == 4)73 (*pt2Object.*function)(subLoads.getString(0), subLoads.getString(1), subLoads.getString(2), subLoads.getString(3));74 else75 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n",76 paramName, pt2Object->getClassName(), 4, subLoads.getCount());77 }78 else79 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());80 };81 82 // 1. FLOAT83 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(float))84 {85 const char* loadString = grabParameter(root, paramName);86 if (loadString != NULL)87 (*pt2Object.*function)(atof(loadString));88 else89 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());90 };91 92 // 2. FLOAT93 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(float, float))94 {95 const char* loadString = grabParameter(root, paramName);96 if (loadString != NULL)97 {98 SubString subLoads(loadString);99 if (subLoads.getCount() == 2)100 (*pt2Object.*function)(atof(subLoads.getString(0)), atof(subLoads.getString(1)));101 else102 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n",103 paramName, pt2Object->getClassName(), 2, subLoads.getCount());104 105 }106 else107 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());108 };109 110 // 3. FLOAT111 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(float, float, float))112 {113 const char* loadString = grabParameter(root, paramName);114 if (loadString != NULL)115 {116 SubString subLoads(loadString);117 if (subLoads.getCount() == 3)118 (*pt2Object.*function)(atof(subLoads.getString(0)), atof(subLoads.getString(1)), atof(subLoads.getString(2)));119 else120 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n",121 paramName, pt2Object->getClassName(), 3, subLoads.getCount());122 }123 else124 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());125 };126 127 // 4. FLOAT128 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(float, float, float, float))129 {130 const char* loadString = grabParameter(root, paramName);131 if (loadString != NULL)132 {133 SubString subLoads(loadString);134 if (subLoads.getCount() == 4)135 (*pt2Object.*function)(atof(subLoads.getString(0)), atof(subLoads.getString(1)), atof(subLoads.getString(2)), atof(subLoads.getString(3)));136 else137 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n",138 paramName, pt2Object->getClassName(), 4, subLoads.getCount());139 140 }141 else142 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());143 };144 145 // 1. INT146 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(int))147 {148 const char* loadString = grabParameter(root, paramName);149 if (loadString != NULL)150 (*pt2Object.*function)(atoi(loadString));151 else152 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());153 };154 155 // 2. INT156 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(int, int))157 {158 const char* loadString = grabParameter(root, paramName);159 if (loadString != NULL)160 {161 SubString subLoads(loadString);162 if (subLoads.getCount() == 2)163 (*pt2Object.*function)(atoi(subLoads.getString(0)), atoi(subLoads.getString(1)));164 else165 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n",166 paramName, pt2Object->getClassName(), 2, subLoads.getCount());167 168 }169 else170 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());171 };172 173 // 3. INT174 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(int, int, int))175 {176 const char* loadString = grabParameter(root, paramName);177 if (loadString != NULL)178 {179 SubString subLoads(loadString);180 if (subLoads.getCount() == 3)181 (*pt2Object.*function)(atoi(subLoads.getString(0)), atoi(subLoads.getString(1)), atoi(subLoads.getString(2)));182 else183 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n",184 paramName, pt2Object->getClassName(), 3, subLoads.getCount());185 186 }187 else188 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());189 };190 191 // 4. INT192 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(int, int, int, int))193 {194 const char* loadString = grabParameter(root, paramName);195 if (loadString != NULL)196 {197 SubString subLoads(loadString);198 if (subLoads.getCount() == 4)199 (*pt2Object.*function)(atoi(subLoads.getString(0)), atoi(subLoads.getString(1)), atoi(subLoads.getString(2)), atoi(subLoads.getString(3)));200 else201 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n",202 paramName, pt2Object->getClassName(), 4, subLoads.getCount());203 }204 else205 PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName());206 };207 132 208 133 }; -
orxonox/branches/levelLoader/src/world_entities/skybox.cc
r4247 r4249 46 46 \param fileName the file to take as input for the SkyBox 47 47 */ 48 SkyBox::SkyBox(c har* fileName)48 SkyBox::SkyBox(const char* fileName) 49 49 { 50 50 this->preInit(); 51 if (fileName) 52 this->setTextureAndType(fileName, ".jpg"); 51 53 this->postInit(); 52 54 } -
orxonox/branches/levelLoader/src/world_entities/skybox.h
r4242 r4249 21 21 { 22 22 public: 23 SkyBox(c har* fileName = NULL);23 SkyBox(const char* fileName = NULL); 24 24 SkyBox(TiXmlElement* root); 25 25
Note: See TracChangeset
for help on using the changeset viewer.