Changeset 1854
- Timestamp:
- Sep 28, 2008, 5:30:14 PM (16 years ago)
- Location:
- code/trunk/src
- Files:
-
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/CMakeLists.txt
r1810 r1854 13 13 # it ourselves. 14 14 # So first, find out what CEGUI version we have. 15 IF (${CEGUI_VERSION} LESS 0.6.0) 16 ADD_SUBDIRECTORY(ceguilua-0.5.0b) 17 INCLUDE_DIRECTORIES(ceguilua-0.5.0b) 18 ELSE (${CEGUI_VERSION} LESS 0.6.0) 19 ADD_SUBDIRECTORY(ceguilua-0.6.1) 15 16 IF (WIN32) 17 ADD_SUBDIRECTORY(ceguilua-0.6.1/ceguilua) 20 18 INCLUDE_DIRECTORIES(ceguilua-0.6.1) 21 ENDIF (${CEGUI_VERSION} LESS 0.6.0) 19 ELSE (WIN32) 20 IF (${CEGUI_VERSION} LESS 0.6.0) 21 ADD_SUBDIRECTORY(ceguilua-0.5.0b/ceguilua) 22 INCLUDE_DIRECTORIES(ceguilua-0.5.0b) 23 ELSE (${CEGUI_VERSION} LESS 0.6.0) 24 ADD_SUBDIRECTORY(ceguilua-0.6.1/ceguilua) 25 INCLUDE_DIRECTORIES(ceguilua-0.6.1) 26 ENDIF (${CEGUI_VERSION} LESS 0.6.0) 27 ENDIF (WIN32) 22 28 23 29 -
code/trunk/src/ceguilua-0.5.0b/ceguilua/CMakeLists.txt
r1810 r1854 10 10 ADD_LIBRARY( ceguilua_orxonox SHARED ${CEGUILUA_SRC_FILES} ) 11 11 12 TARGET_LINK_LIBRARIES( ceguilua_orxonox lua_orxonox ) 12 TARGET_LINK_LIBRARIES(ceguilua_orxonox 13 lua_orxonox 14 tolualib_orxonox 15 ${CEGUI_LIBRARIES} 16 ) -
code/trunk/src/ceguilua-0.6.1/ceguilua/CMakeLists.txt
r1814 r1854 10 10 ADD_LIBRARY( ceguilua_orxonox SHARED ${CEGUILUA_SRC_FILES} ) 11 11 12 TARGET_LINK_LIBRARIES( ceguilua_orxonox lua_orxonox ) 12 TARGET_LINK_LIBRARIES(ceguilua_orxonox 13 lua_orxonox 14 tolualib_orxonox 15 ${CEGUI_LIBRARIES} 16 ) -
code/trunk/src/core/Iterator.h
r1747 r1854 35 35 36 36 Usage: 37 for (Iterator<myClass> it = anyidentifier->getObjects() .begin(); it != anyidentifier->getObjects().end(); ++it)37 for (Iterator<myClass> it = anyidentifier->getObjects()->begin(); it != anyidentifier->getObjects()->end(); ++it) 38 38 { 39 39 it->someFunction(...); -
code/trunk/src/core/Namespace.cc
r1747 r1854 101 101 } 102 102 103 XMLPortObject (Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, mode, true, false);103 XMLPortObjectExtended(Namespace, BaseObject, "", loadObjects, saveObjects, xmlelement, mode, true, false); 104 104 } 105 105 -
code/trunk/src/core/ObjectListBase.h
r1747 r1854 71 71 { 72 72 public: 73 ObjectListElement(T* object) : ObjectListBaseElement( object), object_(object) {}73 ObjectListElement(T* object) : ObjectListBaseElement((OrxonoxClass*)object), object_(object) {} 74 74 T* object_; //!< The object 75 75 }; -
code/trunk/src/core/XMLPort.h
r1841 r1854 26 26 * 27 27 */ 28 29 /** 30 @file XMLPort.h 31 @brief Declaration of the XMLPort helper classes and macros. 32 33 XMLPort is a virtual function of every BaseObject. Every object can change this function. 34 The XMLPort function gets called with an XMLElement, containing all attributes and 35 subclasses the object gets from the levelfile. 36 37 This file declares classes and macros to simplify XML-parsing. 38 */ 28 39 29 40 #ifndef _XMLPort_H__ … … 40 51 #include "BaseObject.h" 41 52 42 53 // ------------ 54 // XMLPortParam 55 56 /** 57 @brief Declares an XML attribute with a name, which will be set through load- and savefunctions. 58 @param classname The name of the class owning this param 59 @param paramname The name of the attribute 60 @param loadfunction A function to set the param in the object with a given value (~a set-function) 61 @param savefunction A function to get the value of the param from the object (~a get-function) 62 @param xmlelement The XMLElement, you get this from the XMLPort function 63 @param mode The mode (load or save), you get this from the XMLPort function 64 65 In the XML file, a param or attribute will be set like this: 66 <classname paramname="value" /> 67 68 The macro will then call loadfunction(value) to set the given value (or call savefunction() to 69 write an existing value to an XML file). 70 */ 43 71 #define XMLPortParam(classname, paramname, loadfunction, savefunction, xmlelement, mode) \ 44 72 XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode) 73 /** 74 @brief This is the same as XMLPortParam, but you can set the template arguments needed to store the loadfunction. 75 76 Sometimes the name of the loadfunction is ambiguous (example: setPosition(Vector3) or 77 setPosition(float, float, float)). In this case, you can choose the right function by 78 telling the types of the functionparams. In our example, this would be either 79 > XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, Vector3); 80 or 81 > XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, float, float, float); 82 You don't have to use this, if there exist only one function with the given name. 83 */ 45 84 #define XMLPortParamTemplate(classname, paramname, loadfunction, savefunction, xmlelement, mode, ...) \ 46 85 XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode) 47 86 87 // -------------------- 88 // XMLPortParamLoadOnly 89 90 /** 91 @brief Declares an XML attribute with a name, which can be set through a loadfunction. 92 93 This is the same as XMLPortParam, but you don't need a savefunction (get-function). Therefore, 94 this param won't be saved in an XML file, but you can add the attribute manually an it will be 95 loaded. 96 97 This might be helpful in cases, when you have several options to set a value, for example the 98 rotation. You can set the rotation with a quaternion, but you could also use three angles. 99 When saving the object, only one of both options has to be saved; this is, where this macro helps. 100 */ 48 101 #define XMLPortParamLoadOnly(classname, paramname, loadfunction, xmlelement, mode) \ 49 102 XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), 0, xmlelement, mode) 103 /** 104 @brief This is the same as XMLPortParamTemplate, but for load-only attributes (see XMLPortParamLoadOnly). 105 */ 50 106 #define XMLPortParamLoadOnlyTemplate(classname, paramname, loadfunction, xmlelement, mode, ...) \ 51 107 XMLPortParamGeneric(xmlcontainer##loadfunction##0, classname, classname, this, paramname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), 0, xmlelement, mode) 52 108 109 // ------------------ 110 // XMLPortParamExtern 111 112 /** 113 @brief This is the same as XMLPortParam, but for attributes in an extern class. 114 @param classname The name of the class owning the object owning the attribute 115 @param externclass The name of the extern class (the objects class) 116 @param object The name of the object of the extern class (a member of the main class) 117 @param paramname The name of the attribute 118 @param loadfunction The function to set the attribute inside of the member object. 119 @param loadfunction The function to get the attribute from the member object 120 121 Sometimes you'll have a member object in your class, which has it's own load- and savefunctions. 122 With this macro, you can simply use them instead of writing your own functions. 123 124 @example 125 Your class is called SpaceShip and this class has an object (myPilot_) of class Pilot. Pilot has a name 126 and two functions, setName(name) and getName(). Now you want an attribute "pilotname" in your 127 SpaceShip class. Instead of writing wrapper functions, you can simply use the XMLPortParamExtern 128 macro: 129 > XMLPortParamExtern(SpaceShip, Pilot, myPilot_, "pilotname", setName, getName, xmlelement, mode); 130 */ 53 131 #define XMLPortParamExtern(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode) \ 54 132 XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, orxonox::createExecutor(orxonox::createFunctor(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction), xmlelement, mode); 133 /** 134 @brief This is the same as XMLPortParamTemplate, but for extern attributes (see XMLPortParamExtern). 135 */ 55 136 #define XMLPortParamExternTemplate(classname, externclass, object, paramname, loadfunction, savefunction, xmlelement, mode, ...) \ 56 137 XMLPortParamGeneric(xmlcontainer##loadfunction##savefunction, classname, externclass, object, paramname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&externclass::loadfunction), std::string( #externclass ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&externclass::savefunction), std::string( #externclass ) + "::" + #savefunction), xmlelement, mode); 57 138 139 // ------------------- 140 // XMLPortParamGeneric 141 142 /** 143 @brief This is the generic XMLPort param macro, which is used by all six specialized macros above. 144 */ 58 145 #define XMLPortParamGeneric(containername, classname, objectclass, object, paramname, loadexecutor, saveexecutor, xmlelement, mode) \ 59 146 orxonox::XMLPortClassParamContainer<objectclass>* containername = (orxonox::XMLPortClassParamContainer<objectclass>*)(ClassIdentifier<classname>::getIdentifier()->getXMLPortParamContainer(paramname)); \ … … 65 152 containername->port((BaseObject*)this, object, xmlelement, mode) 66 153 67 68 #define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \ 154 // -------------------- 155 // XMLPortObjectExtended 156 157 /** 158 @brief Declares a possible sub-object that can be added in the XML file. 159 @param classname The name of the class that uses this macro 160 @param objectclass The baseclass of objects that can be added 161 @param sectionname The name of the subsection in the XML file that encloses the sub-objects ("" means no subsection) 162 @param loadfunction The function to add a new object to the class 163 @param loadfunction The function to get all added objects from the class 164 @param xmlelement The XMLElement (recieved through the XMLPort function) 165 @param mode The mode (load/save) (received through the XMLPort function) 166 @param bApplyLoaderMask If this is true, an added sub-object only gets loaded if it's class is included in the Loaders ClassTreeMask (this is usually false) 167 @param bLoadBefore If this is true, the sub-cobject gets loaded (through XMLPort) BEFORE it gets added to the main class (this is usually true) 168 169 bApplyLoaderMask is usually false for the following reason: 170 If the loaders mask says, for example, "load only SpaceShips" and you added weapons to the 171 SpaceShips, then the Weapons will still be loaded (which is most probably what you want). 172 Of course, if there are "standalone" weapons in the level, they wont be loaded. 173 174 If bLoadBefore, an added object already has all attributes set (like it's name). This is most 175 likely the best option, so this is usually true. 176 177 @note 178 The load- and savefunctions have to follow an exactly defined protocol. 179 Loadfunction: 180 The loadfunction gets a pointer to the object. 181 > void loadfunction(objectclass* pointer); 182 183 Savefunction: 184 The savefunction gets an index, starting with 0. For every returnvalue != 0, the savefunction 185 gets called again, but with index + 1. It's the functions responsibility to do something smart 186 with the index and to return 0 if all objects were returned. 187 > objectclass* savefunction(unsigned int index) const; 188 189 Possible implementation: 190 objectclass* savefunction(unsigned int index) const 191 { 192 if (index < number_of_added_objects_) 193 return my_added_objects[index]; 194 else 195 return 0; 196 } 197 198 @example 199 Possible usage of the macro: 200 > XMLPortObject(SpaceShip, Weapon, "weapons", addWeapon, getWeapon, xmlelement, mode, false, true); 201 202 Now you can add weapons through the XML file: 203 <SpaceShip someattribute="..." ...> 204 <weapons> 205 <Weapon someattribute="..." ... /> 206 <Weapon someattribute="..." ... /> 207 <Weapon someattribute="..." ... /> 208 </weapons> 209 </SpaceShip> 210 211 Note that "weapons" is the subsection. This allows you to add more types of sub-objects. In our example, 212 you could add pilots, blinking lights or other stuff. If you don't want a subsection, just use "" (an 213 empty string). The you can add sub-objects directly into the mainclass. 214 */ 215 #define XMLPortObjectExtended(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \ 69 216 XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore) 70 #define XMLPortObjectTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore, ...) \ 217 /** 218 @brief This is the same as XMLPortObjectExtended, but you can specify the loadfunction by adding the param types. See XMLPortParamTemplate for more details about the types. 219 */ 220 #define XMLPortObjectExtendedTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, bApplyLoaderMask, bLoadBefore, ...) \ 71 221 XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, bApplyLoaderMask, bLoadBefore) 72 222 223 // ------------- 224 // XMLPortObject 225 226 /** 227 @brief This is the same as XMLPortObjectExtended, but bApplyLoaderMask is false and bLoadBefore is true by default. 228 */ 229 #define XMLPortObject(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode) \ 230 XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, false, true) 231 /** 232 @brief This is the same as XMLPortObject, but you can specify the loadfunction by adding the param types. See XMLPortParamTemplate for more details about the types. 233 */ 234 #define XMLPortObjectTemplate(classname, objectclass, sectionname, loadfunction, savefunction, xmlelement, mode, ...) \ 235 XMLPortObjectGeneric(xmlcontainer##loadfunction##savefunction, classname, objectclass, sectionname, orxonox::createExecutor(orxonox::createFunctor< __VA_ARGS__ >(&classname::loadfunction), std::string( #classname ) + "::" + #loadfunction), orxonox::createExecutor(orxonox::createFunctor(&classname::savefunction), std::string( #classname ) + "::" + #savefunction), xmlelement, mode, false, true) 236 237 // -------------------- 238 // XMLPortObjectGeneric 239 240 /** 241 @brief Generic XMLPortObject macro, that gets called by all other XMLPortObject macros above. 242 */ 73 243 #define XMLPortObjectGeneric(containername, classname, objectclass, sectionname, loadexecutor, saveexecutor, xmlelement, mode, bApplyLoaderMask, bLoadBefore) \ 74 244 orxonox::XMLPortClassObjectContainer<classname, objectclass>* containername = (orxonox::XMLPortClassObjectContainer<classname, objectclass>*)(ClassIdentifier<classname>::getIdentifier()->getXMLPortObjectContainer(sectionname)); \ -
code/trunk/src/orxonox/objects/WorldEntity.cc
r1755 r1854 120 120 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, mode); 121 121 122 XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode , false, true);122 XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode); 123 123 124 124 WorldEntity::create(); -
code/trunk/src/orxonox/overlays/OverlayGroup.cc
r1747 r1854 68 68 XMLPortParam(OverlayGroup, "scroll", setScroll, getScroll, xmlElement, mode).defaultValues(Vector2(0.0, 0.0)); 69 69 // loads all the child elements 70 XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode , false, true);70 XMLPortObject(OverlayGroup, OrxonoxOverlay, "", addElement, getElement, xmlElement, mode); 71 71 } 72 72 -
code/trunk/src/orxonox/overlays/hud/HUDBar.cc
r1747 r1854 100 100 XMLPortParam(HUDBar, "rightToLeft", setRightToLeft, getRightToLeft, xmlElement, mode).defaultValues(false); 101 101 XMLPortParam(HUDBar, "autoColour", setAutoColour, getAutoColour, xmlElement, mode).defaultValues(true); 102 XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode , false, true);102 XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode); 103 103 } 104 104 -
code/trunk/src/util/MultiType.h
r1791 r1854 189 189 virtual void toString(std::ostream& outstream) const = 0; 190 190 191 MT_Type type_; //! The type of the current value191 MT_Type type_; //!< The type of the current value 192 192 }; 193 193 … … 388 388 template <typename T> void createNewValueContainer(const T& value) { BOOST_STATIC_ASSERT(sizeof(T) == 0); } 389 389 390 MT_ValueBase* value_; //! A pointer to the value container390 MT_ValueBase* value_; //!< A pointer to the value container 391 391 }; 392 392 -
code/trunk/src/util/MultiTypeValue.h
r1791 r1854 110 110 inline void toString(std::ostream& outstream) const { outstream << this->value_; } 111 111 112 T value_; //! The stored value112 T value_; //!< The stored value 113 113 }; 114 114 -
code/trunk/src/util/OutputBuffer.h
r1791 r1854 167 167 void callListeners(); 168 168 169 std::stringstream stream_; //! The stringstream that stores the assigned text170 std::list<OutputBufferListener*> listeners_; //! A list of all listeners169 std::stringstream stream_; //!< The stringstream that stores the assigned text 170 std::list<OutputBufferListener*> listeners_; //!< A list of all listeners 171 171 }; 172 172 }
Note: See TracChangeset
for help on using the changeset viewer.