Changeset 9685 in orxonox.OLD for branches/new_class_id
- Timestamp:
- Aug 22, 2006, 1:16:23 PM (18 years ago)
- Location:
- branches/new_class_id/src
- Files:
-
- 57 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/effects/atmospheric_engine.cc
r9406 r9685 22 22 #include "util/loading/load_param.h" 23 23 #include "util/loading/factory.h" 24 #include "class_list.h"25 24 26 27 25 NewObjectListDefinition(AtmosphericEngine); 28 26 29 27 /** 30 28 * @param root The XML-element to load the AtmosphericEngine from 31 29 */ 32 AtmosphericEngine::AtmosphericEngine() { 33 this->setClassID(CL_ATMOSPHERIC_ENGINE, "AtmosphericEngine"); 30 AtmosphericEngine::AtmosphericEngine() 31 { 32 this->registerObject(this, AtmosphericEngine::_objectList); 34 33 } 35 34 … … 43 42 * destroys a AtmosphericEngine 44 43 */ 45 AtmosphericEngine::~AtmosphericEngine() { 46 AtmosphericEngine::singletonRef = NULL; 44 AtmosphericEngine::~AtmosphericEngine() 45 { 46 AtmosphericEngine::singletonRef = NULL; 47 47 48 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 49 50 if (weatherEffects != NULL) { 51 while(!weatherEffects->empty()) 52 delete weatherEffects->front(); 53 } 48 while(!WeatherEffect::objectList().empty()) 49 delete WeatherEffect::objectList().front(); 54 50 } 55 51 … … 57 53 * @param root The XML-element to load the AtmosphericEngine from 58 54 */ 59 void AtmosphericEngine::loadParams(const TiXmlElement* root) { 60 LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect); 61 LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect); 55 void AtmosphericEngine::loadParams(const TiXmlElement* root) 56 { 57 LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect); 58 LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect); 62 59 } 63 60 … … 65 62 * @param root The XML-element to load WeatherEffects from 66 63 */ 67 void AtmosphericEngine::loadWeatherEffect(const TiXmlElement* root) { 68 LOAD_PARAM_START_CYCLE(root, element); 69 { 70 PRINTF(4)("element is: %s\n", element->Value()); 71 // Factory::fabricate(element); 64 void AtmosphericEngine::loadWeatherEffect(const TiXmlElement* root) 65 { 66 LOAD_PARAM_START_CYCLE(root, element); 67 { 68 PRINTF(4)("element is: %s\n", element->Value()); 69 // Factory::fabricate(element); 72 70 73 74 75 76 77 71 BaseObject* bo = Factory::fabricate(element); 72 if( bo == NULL) 73 PRINTF(0)(" Could not create Element %s\n", element->Value()); 74 } 75 LOAD_PARAM_END_CYCLE(element); 78 76 } 79 77 … … 81 79 * @param root The XML-element to load SunEffects from 82 80 */ 83 void AtmosphericEngine::loadSunEffect(const TiXmlElement* root) { 84 LOAD_PARAM_START_CYCLE(root, element); 85 { 86 PRINTF(4)("element is: %s\n", element->Value()); 87 } 88 LOAD_PARAM_END_CYCLE(element); 81 void AtmosphericEngine::loadSunEffect(const TiXmlElement* root) 82 { 83 LOAD_PARAM_START_CYCLE(root, element); 84 { 85 PRINTF(4)("element is: %s\n", element->Value()); 86 } 87 LOAD_PARAM_END_CYCLE(element); 89 88 } 90 89 … … 93 92 * draws the effect, if needed 94 93 */ 95 void AtmosphericEngine::draw() const { 96 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 97 98 // draw the weather effects 99 if (weatherEffects != NULL) { 100 std::list<BaseObject*>::const_iterator it; 101 for (it = weatherEffects->begin(); it != weatherEffects->end(); it++) 102 dynamic_cast<WeatherEffect*>(*it)->draw(); 103 } 94 void AtmosphericEngine::draw() const 95 { 96 for (NewObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin(); 97 it != WeatherEffect::objectList().end(); 98 ++it) 99 (*it)->draw(); 104 100 } 105 101 … … 109 105 * ticks the effect if there is any time dependancy 110 106 */ 111 void AtmosphericEngine::tick(float dt) {112 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 107 void AtmosphericEngine::tick(float dt) 108 { 113 109 114 // tick the weather effects 115 if (weatherEffects != NULL) { 116 std::list<BaseObject*>::const_iterator it; 117 for (it = weatherEffects->begin(); it != weatherEffects->end(); it++) { 118 /* printf("%s::%s \n", (*it)->getClassCName(), (*it)->getName());*/ 119 dynamic_cast<WeatherEffect*>(*it)->tick(dt); 120 } 121 } 110 for (NewObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin(); 111 it != WeatherEffect::objectList().end(); 112 ++it) 113 (*it)->tick(dt); 122 114 } -
branches/new_class_id/src/lib/graphics/effects/atmospheric_engine.h
r7810 r9685 1 1 /*! 2 2 * @file atmospheric_engine.h 3 * 3 * 4 4 */ 5 5 … … 14 14 class AtmosphericEngine : public BaseObject 15 15 { 16 NewObjectListDeclaration(AtmosphericEngine); 16 17 public: 17 18 ~AtmosphericEngine(); -
branches/new_class_id/src/lib/graphics/effects/graphics_effect.cc
r9406 r9685 22 22 #include "util/loading/load_param.h" 23 23 24 25 26 27 24 NewObjectListDefinition(GraphicsEffect); 28 25 29 26 /** … … 33 30 */ 34 31 GraphicsEffect::GraphicsEffect(const TiXmlElement* root) { 35 this->setClassID(CL_GRAPHICS_EFFECT, "GraphicsEffect");32 this->registerObject(this, GraphicsEffect::_objectList); 36 33 this->bActivated = false; 37 34 } -
branches/new_class_id/src/lib/graphics/effects/graphics_effect.h
r8495 r9685 13 13 //! A class that handles GraphicsEffects. The GraphicsEffectManager operates on this. 14 14 class GraphicsEffect : public BaseObject { 15 public: 15 NewObjectListDeclaration(GraphicsEffect); 16 public: 16 17 GraphicsEffect(const TiXmlElement* root = NULL); 17 18 virtual ~GraphicsEffect(); -
branches/new_class_id/src/lib/graphics/effects/weather_effect.cc
r9406 r9685 20 20 #include "util/loading/load_param.h" 21 21 22 23 24 22 NewObjectListDefinition(WeatherEffect); 25 23 26 24 /** … … 29 27 WeatherEffect::WeatherEffect(const TiXmlElement* root) 30 28 { 31 this-> setClassID(CL_WEATHER_EFFECT, "WeatherEffect");29 this->registerObject(this, WeatherEffect::_objectList); 32 30 this->bActivated = false; 33 31 } -
branches/new_class_id/src/lib/graphics/effects/weather_effect.h
r8495 r9685 12 12 class WeatherEffect : public BaseObject 13 13 { 14 NewObjectListDeclaration(WeatherEffect); 15 14 16 public: 15 17 WeatherEffect(const TiXmlElement* root = NULL); -
branches/new_class_id/src/lib/graphics/graphics_engine.cc
r9406 r9685 45 45 #include "util/loading/load_param.h" 46 46 #include "util/loading/factory.h" 47 #include "class_list.h"48 47 49 48 #ifdef __WIN32__ … … 54 53 SHELL_COMMAND(fps, GraphicsEngine, toggleFPSdisplay); 55 54 55 NewObjectListDefinition(GraphicsEngine); 56 56 57 /** 57 58 * @brief standard constructor … … 59 60 GraphicsEngine::GraphicsEngine () 60 61 { 61 this-> setClassID(CL_GRAPHICS_ENGINE, "GraphicsEngine");62 this->registerObject(this, GraphicsEngine::_objectList); 62 63 this->setName("GraphicsEngine"); 63 64 … … 590 591 591 592 // tick the graphics effects 592 if (this->graphicsEffects != NULL || (this->graphicsEffects = ClassList::getList(CL_GRAPHICS_EFFECT)) != NULL) 593 { 594 std::list<BaseObject*>::const_iterator it; 595 for (it = this->graphicsEffects->begin(); it != this->graphicsEffects->end(); it++) 596 dynamic_cast<GraphicsEffect*>(*it)->tick(dt); 597 } 593 for (NewObjectList<GraphicsEffect>::const_iterator it = GraphicsEffect::objectList().begin(); 594 it != GraphicsEffect::objectList().end(); 595 ++it) 596 (*it)->tick(dt); 598 597 } 599 598 … … 688 687 { 689 688 case EV_VIDEO_RESIZE: 690 691 692 } 693 } 689 this->resolutionChanged(event.resize); 690 break; 691 } 692 } -
branches/new_class_id/src/lib/graphics/graphics_engine.h
r9406 r9685 30 30 class GraphicsEngine : public EventListener 31 31 { 32 NewObjectListDeclaration(GraphicsEngine); 32 33 public: 33 34 virtual ~GraphicsEngine(); -
branches/new_class_id/src/lib/graphics/importer/material.cc
r9406 r9685 27 27 #include "util/loading/resource_manager.h" 28 28 29 NewObjectListDefinition(Material); 30 29 31 /** 30 32 * @brief creates a Material. … … 33 35 Material::Material (const std::string& mtlName) 34 36 { 35 this-> setClassID(CL_MATERIAL, "Material");37 this->registerObject(this, Material::_objectList); 36 38 37 39 this->setIllum(3); -
branches/new_class_id/src/lib/graphics/importer/material.h
r8761 r9685 24 24 class Material : public BaseObject 25 25 { 26 NewObjectListDeclaration(Material); 26 27 public: 27 28 Material (const std::string& mtlName = ""); -
branches/new_class_id/src/lib/graphics/importer/md2/md2Model.cc
r9406 r9685 22 22 23 23 24 24 NewObjectListDefinition(MD2Model); 25 25 26 26 //! the model anorms … … 78 78 MD2Model::MD2Model(const std::string& modelFileName, const std::string& skinFileName, float scale) 79 79 { 80 this-> setClassID(CL_MD2_MODEL, "MD2Model");80 this->registerObject(this, MD2Model::_objectList); 81 81 /* this creates the data container via ressource manager */ 82 82 if (!modelFileName.empty()) -
branches/new_class_id/src/lib/graphics/importer/md2/md2Model.h
r9235 r9685 149 149 //! This is a MD2 Model class 150 150 class MD2Model : public InteractiveModel { 151 151 NewObjectListDeclaration(MD2Model); 152 152 public: 153 153 MD2Model(const std::string& modelFileName, const std::string& skinFileName = "", float scale = 1.0f); -
branches/new_class_id/src/lib/graphics/importer/media_container.cc
r8316 r9685 30 30 #include "debug.h" 31 31 32 NewObjectListDefinition(MediaContainer); 32 33 33 34 /** … … 37 38 { 38 39 // set the class id for the base object 39 this-> setClassID(CL_MEDIA_CONTAINER, "MediaContainer");40 this->registerObject(this, MediaContainer::_objectList); 40 41 41 42 fps = 0; -
branches/new_class_id/src/lib/graphics/importer/media_container.h
r7221 r9685 24 24 class MediaContainer : public TextureSequence 25 25 { 26 26 NewObjectListDeclaration(MediaContainer); 27 27 private: 28 28 -
branches/new_class_id/src/lib/graphics/importer/movie_player.cc
r7221 r9685 30 30 #include "debug.h" 31 31 32 NewObjectListDefinition(MoviePlayer); 32 33 33 34 MoviePlayer::MoviePlayer(const std::string& filename) 34 35 { 35 36 // set the class id for the base object 36 this->setClassID(CL_MOVIE_PLAYER, "MoviePlayer"); 37 37 this->registerObject(this, MoviePlayer::_objectList); 38 38 status = STOP; 39 39 timer = 0; -
branches/new_class_id/src/lib/graphics/importer/movie_player.h
r7221 r9685 31 31 class MoviePlayer : public BaseObject 32 32 { 33 NewObjectListDeclaration(MoviePlayer); 33 34 34 35 private: -
branches/new_class_id/src/lib/graphics/importer/texture.cc
r9406 r9685 64 64 #endif 65 65 66 66 NewObjectListDefinition(Texture); 67 67 68 68 /** … … 86 86 : data(texture.data) 87 87 { 88 this-> setClassID(CL_TEXTURE, "Texture");88 this->registerObject(this, Texture::_objectList); 89 89 this->priority = 0.5; 90 90 } … … 149 149 void Texture::init() 150 150 { 151 this-> setClassID(CL_TEXTURE, "Texture");151 this->registerObject(this, Texture::_objectList); 152 152 153 153 this->data = TextureDataPointer(new TextureData()); -
branches/new_class_id/src/lib/graphics/importer/texture.h
r8761 r9685 20 20 class Texture : public BaseObject 21 21 { 22 NewObjectListDeclaration(Texture); 22 23 public: 23 24 Texture(); -
branches/new_class_id/src/lib/graphics/importer/texture_sequence.cc
r9406 r9685 28 28 #endif 29 29 30 NewObjectListDefinition(TextureSequence); 31 30 32 /** 31 33 * @brief Constructor for a Texture … … 33 35 TextureSequence::TextureSequence(unsigned int count, ...) 34 36 { 35 this-> setClassID(CL_TEXTURE_SEQUENCE, "TextureSequence");37 this->registerObject(this, TextureSequence::_objectList); 36 38 37 39 va_list textureNameList; … … 54 56 TextureSequence::TextureSequence(const std::vector<std::string>& textureNames, const std::string& prependFolder) 55 57 { 56 this-> setClassID(CL_TEXTURE_SEQUENCE, "TextureSequence");58 this->registerObject(this, TextureSequence::_objectList); 57 59 this->loadImageSeries(textureNames, prependFolder); 58 60 } -
branches/new_class_id/src/lib/graphics/importer/texture_sequence.h
r8324 r9685 15 15 class TextureSequence : public Texture 16 16 { 17 NewObjectListDeclaration(TextureSequence); 17 18 public: 18 19 TextureSequence(unsigned int count = 0, ...); -
branches/new_class_id/src/lib/graphics/light.cc
r8742 r9685 27 27 #include "debug.h" 28 28 29 #include "class_id.h" 30 29 31 CREATE_FACTORY(Light, CL_LIGHT); 32 NewObjectListDefinitionID(Light, CL_LIGHT); 30 33 31 34 //! Definition of the Lights and their Names … … 51 54 PRINTF(4)("initializing Light number %d.\n", this->lightNumber); 52 55 56 this->registerObject(this, Light::_objectList); 57 53 58 this->lightNumber = LightManager::getInstance()->registerLight(this); 54 59 55 this->setClassID(CL_LIGHT, "Light");56 60 char tmpName[10]; 57 61 sprintf(tmpName, "Light[%d]", this->lightNumber); … … 211 215 ** LIGHT-MANAGER ** 212 216 ******************/ 217 NewObjectListDefinition(LightManager); 213 218 /** 214 219 * standard constructor for a Light … … 216 221 LightManager::LightManager () 217 222 { 218 this-> setClassID(CL_LIGHT_MANAGER, "LightManager");223 this->registerObject(this, LightManager::_objectList); 219 224 220 225 glEnable (GL_LIGHTING); -
branches/new_class_id/src/lib/graphics/light.h
r8255 r9685 25 25 class Light : public PNode 26 26 { 27 public: 28 Light(const TiXmlElement* root = NULL); 29 virtual ~Light(); 30 31 virtual void loadParams(const TiXmlElement* root); 32 33 void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b); 34 void setSpecularColor(GLfloat r, GLfloat g, GLfloat b); 35 void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation); 36 void setSpotDirection(const Vector& direction); 37 void setSpotDirection(float x, float y, float z) { setSpotDirection(Vector(x,y,z)); }; 38 void setSpotCutoff(GLfloat cutoff); 39 40 /** @returns the lightNumber*/ 41 int getLightNumber() const {return this->lightNumber;} 42 43 virtual void draw() const; 44 45 void debug() const; 46 47 // attributes 48 private: 49 int lightNumber; //!< The number of this Light. 50 GLfloat diffuseColor[4]; //!< The Diffuse Color this Light emmits. 51 GLfloat specularColor[4]; //!< The specular Color of this Light. 52 float constantAttenuation; //!< The Factor of the the Constant Attenuation. 53 float linearAttenuation; //!< The Factor of the the Linear Attenuation. 54 float quadraticAttenuation; //!< The Factor of the the Quadratic Attenuation. 55 GLfloat spotDirection[4]; //!< The direction of the Spot Light. 56 GLfloat spotCutoff; //!< The cutoff Angle of the Light Source 27 NewObjectListDeclaration(Light); 28 public: 29 Light(const TiXmlElement* root = NULL); 30 virtual ~Light(); 31 32 virtual void loadParams(const TiXmlElement* root); 33 34 void setDiffuseColor(GLfloat r, GLfloat g, GLfloat b); 35 void setSpecularColor(GLfloat r, GLfloat g, GLfloat b); 36 void setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation); 37 void setSpotDirection(const Vector& direction); 38 void setSpotDirection(float x, float y, float z) { setSpotDirection(Vector(x,y,z)); }; 39 void setSpotCutoff(GLfloat cutoff); 40 41 /** @returns the lightNumber*/ 42 int getLightNumber() const {return this->lightNumber;} 43 44 virtual void draw() const; 45 46 void debug() const; 47 48 // attributes 49 private: 50 int lightNumber; //!< The number of this Light. 51 GLfloat diffuseColor[4]; //!< The Diffuse Color this Light emmits. 52 GLfloat specularColor[4]; //!< The specular Color of this Light. 53 float constantAttenuation; //!< The Factor of the the Constant Attenuation. 54 float linearAttenuation; //!< The Factor of the the Linear Attenuation. 55 float quadraticAttenuation; //!< The Factor of the the Quadratic Attenuation. 56 GLfloat spotDirection[4]; //!< The direction of the Spot Light. 57 GLfloat spotCutoff; //!< The cutoff Angle of the Light Source 57 58 }; 58 59 60 59 60 61 61 62 //! A class that handles Lights 62 63 /** … … 87 88 */ 88 89 class LightManager : public BaseObject 89 90 friend class Light;90 { 91 NewObjectListDeclaration(LightManager); 91 92 92 public: 93 virtual ~LightManager(); 94 /** @returns a Pointer to the only object of this Class */ 95 inline static LightManager* getInstance() { if (!singletonRef) singletonRef = new LightManager(); return singletonRef; }; 93 friend class Light; 94 public: 95 virtual ~LightManager(); 96 /** @returns a Pointer to the only object of this Class */ 97 inline static LightManager* getInstance() { if (!singletonRef) singletonRef = new LightManager(); return singletonRef; }; 96 98 97 98 99 virtual void loadParams(const TiXmlElement* root); 100 void loadLights(const TiXmlElement* root); 99 101 100 101 102 102 void setAmbientColor(GLfloat r, GLfloat g, GLfloat b); 103 // HACK: Assuming r = g = b values 104 inline GLfloat getAmbientColor() { return this->ambientColor[0]; } 103 105 104 105 106 Light* getLight(int lightNumber) const; 107 inline Light* getLight() const { return this->currentLight; }; 106 108 107 109 void draw() const; 108 110 109 111 void debug() const; 110 112 111 112 113 private: 114 LightManager(); 113 115 114 115 116 int registerLight(Light* light); 117 void unregisterLight(Light* light); 116 118 117 118 119 119 private: 120 static LightManager* singletonRef; //!< This is the LightHandlers Reference. 121 GLfloat ambientColor[4]; //!< The ambient Color of the scene. 120 122 121 122 123 Light** lights; //!< An array of Lenght NUMBEROFLIGHTS, that holds pointers to all LightValues. 124 Light* currentLight; //!< The current Light, we are working with. 123 125 124 126 }; -
branches/new_class_id/src/lib/graphics/render2D/element_2d.cc
r9406 r9685 29 29 #include "graphics_engine.h" 30 30 #include "util/loading/load_param.h" 31 #include "class_list.h"32 31 33 32 #include "color.h" … … 35 34 #include "shell_command.h" 36 35 SHELL_COMMAND(debug, Element2D, debug2D); 36 37 NewObjectListDefinition(Element2D); 37 38 38 39 … … 46 47 Element2D::Element2D (Element2D* parent, E2D_LAYER layer, short nodeFlags) 47 48 { 48 this-> setClassID(CL_ELEMENT_2D, "Element2D");49 this->registerObject(this, Element2D::_objectList); 49 50 50 51 this->setVisibility(true); … … 268 269 void Element2D::setBindNode(const std::string& bindNode) 269 270 { 270 const PNode* tmpBindNode = dynamic_cast<const PNode*>(ClassList::getObject(bindNode, CL_PARENT_NODE));271 const PNode* tmpBindNode = PNode::objectList().getObject(bindNode); 271 272 if (tmpBindNode != NULL) 272 273 this->bindNode = tmpBindNode; … … 640 641 void Element2D::addChild2D (const std::string& childName) 641 642 { 642 Element2D* childNode = dynamic_cast<Element2D*>(ClassList::getObject(childName, CL_ELEMENT_2D));643 Element2D* childNode = Element2D::objectList().getObject(childName); 643 644 if (childNode != NULL) 644 645 this->addChild2D(childNode); … … 718 719 void Element2D::setParent2D (const std::string& parentName) 719 720 { 720 Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));721 Element2D* parentNode = Element2D::objectList().getObject(parentName); 721 722 if (parentNode != NULL) 722 723 parentNode->addChild2D(this); … … 771 772 void Element2D::setParentSoft2D(const std::string& parentName, float bias) 772 773 { 773 Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));774 Element2D* parentNode = Element2D::objectList().getObject(parentName); 774 775 if (parentNode != NULL) 775 776 this->setParentSoft2D(parentNode, bias); -
branches/new_class_id/src/lib/graphics/render2D/element_2d.h
r8360 r9685 47 47 48 48 E2D_PARENT_MOVEMENT = 0x0004, //!< Moves all children along with the parent. 49 // special linkage modes49 // special linkage modes 50 50 E2D_PARENT_ALL = 0x0003, //!< Moves all children around the center of their parent, and also rotates their centers 51 51 E2D_PARENT_ROTATE_AND_MOVE = 0x0005, //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent. … … 58 58 E2D_REPARENT_DELETE_CHILDREN = 0x0040, //!< Deletes the Children of the node when This Node is Removed. (Use with care). 59 59 /// FIXME 60 60 E2D_REPARENT_KEEP_POSITION = 0x0080, //!< Tries to keep the Position if the Node is reparented. 61 61 62 62 … … 87 87 * -> the tree is sorted on insertion of a new Child: @see Element2D::addChild2D() 88 88 */ 89 class Element2D : virtual public BaseObject { 90 91 public: 92 Element2D(Element2D* parent = Element2D::getNullElement(), E2D_LAYER layer = E2D_DEFAULT_LAYER, short nodeFlags = E2D_PARENT_MODE_DEFAULT); 93 virtual ~Element2D(); 94 95 virtual void loadParams(const TiXmlElement* root); 96 97 // ACTIVATION // 98 inline void activate2D() { this->bActive = this->bRelCoorChanged = this->bRelDirChanged = true; }; 99 inline void deactivate2D() { this->bActive = false; }; 100 inline bool get2DActiveState() { return this->bActive; }; 101 102 // ALIGNMENT // 103 /** @param alignment the new Alignment of the 2D-Element */ 104 inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; }; 105 void setAlignment(const std::string& alignment); 106 inline E2D_ALIGNMENT getAlignment() const { return this->alignment; }; 107 108 // LAYERING // 109 void setLayer(E2D_LAYER layer); 110 void setLayer(const std::string& layer); 111 /** @returns the Layer this Element is drawn to */ 112 inline E2D_LAYER getLayer() const { return this->layer; }; 113 114 // VISIBILITY // 115 /** @param visible true if the Element should be visible false otherwise (will not be rendered) */ 116 inline void setVisibility(bool visible) { this->bVisible = visible; }; 117 /** @returns the visibility state */ 118 inline bool isVisible() const { return (this->bVisible && this->bCurrentlyVisible); }; 119 120 121 // POSITIONAL (E2D-specials) // 122 /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */ 123 void setBindNode(const PNode* bindNode); 124 void setBindNode(const std::string& bindNode); 125 inline const PNode* getBindNode() const { return this->bindNode; }; 126 127 inline void setSize2D(float x, float y) { this->size = Vector2D(x, y); }; 128 inline void setSize2D(const Vector2D& size) { this->size = size; }; 129 inline const Vector2D& getSize2D() const { return this->size; }; 130 void setSizeSoft2D(float x, float y, float bias = 1.0); 131 inline void setSizeX2D(float x) { this->size.x = x; }; 132 inline void setSizeY2D(float y) { this->size.y = y; }; 133 inline float getSizeX2D() const { return this->size.x; }; 134 inline float getSizeY2D() const { return this->size.y; }; 135 136 public: 137 virtual void tick(float dt) {}; 138 virtual void draw() const {}; 139 void tick2D(float dt); 140 void draw2D(E2D_LAYER from, E2D_LAYER to) const; 141 void drawChildren(E2D_LAYER from, E2D_LAYER to) const; 142 143 // LIKE PNODE 144 public: 145 void setRelCoor2D (const Vector2D& relCoord); 146 void setRelCoorX2D(float x); 147 void setRelCoorY2D(float y); 148 void setRelCoor2D (float x, float y); 149 void setRelCoor2Dpx (int x, int y); 150 void setRelCoorSoft2D (const Vector2D& relCoordSoft, float bias = 1.0); 151 void setRelCoorSoft2D (float x, float y, float bias = 1.0); 152 void setRelCoorSoft2Dpx (int x, int y, float bias = 1.0); 153 /** @returns the relative position */ 154 inline const Vector2D& getRelCoor2D () const { return this->prevRelCoordinate; }; 155 /** @returns the Relative Coordinate Destination */ 156 inline const Vector2D& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; }; 157 const Vector2D& getRelCoor2Dpx() const; 158 void setAbsCoor2D (const Vector2D& absCoord); 159 void setAbsCoor2D (float x, float y); 160 void setAbsCoorX2D(float x); 161 void setAbsCoorY2D(float y); 162 void setAbsCoor2Dpx (int x, int y); 163 void setAbsCoorSoft2D (const Vector2D& absCoordSoft, float bias = 1.0); 164 void setAbsCoorSoft2D (float x, float y, float bias = 1.0); 165 /** @returns the absolute position */ 166 inline const Vector2D& getAbsCoor2D () const { return this->absCoordinate; }; 167 const Vector2D& getAbsCoor2Dpx () const; 168 169 void shiftCoor2D (const Vector2D& shift); 170 void shiftCoor2Dpx (int x, int y); 171 172 void setRelDir2D (float relDir); 173 void setRelDirSoft2D(float relDirSoft, float bias = 1.0); 174 /** @returns the relative Direction */ 175 inline float getRelDir2D () const { return this->prevRelDirection; }; 176 /** @returns the Relative Directional Destination */ 177 inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; }; 178 void setAbsDir2D (float absDir); 179 void setAbsDirSoft2D (float absDirSoft, float bias = 1.0); 180 /** @returns the absolute Direction */ 181 inline float getAbsDir2D () const { return this->absDirection; }; 182 void shiftDir2D (float shiftDir); 183 184 /** @returns the Speed of the Node */ 185 inline float getSpeed() const { return 0; }; 186 /** @returns the Velocity of the Node */ 187 inline const Vector2D& getVelocity() const { return this->velocity; }; 188 189 190 void addChild2D (Element2D* child); 191 void addChild2D (const std::string& childName); 192 void removeChild2D (Element2D* child); 193 void remove2D(); 194 195 /** @param parent the new parent of this Element2D */ 196 void setParent2D (Element2D* parent) { parent->addChild2D(this); }; 197 void setParent2D (const std::string& parentName); 198 /** @returns the parent of this Element2D */ 199 inline Element2D* getParent2D () const { return this->parent; }; 200 /** @returns the List of Children of this Element2D */ 201 inline const std::list<Element2D*>& getChildren2D() const { return this->children; }; 202 203 void setParentSoft2D(Element2D* parentNode, float bias = 1.0); 204 void setParentSoft2D(const std::string& parentName, float bias = 1.0); 205 206 void setParentMode2D (E2D_PARENT_MODE parentMode); 207 void setParentMode2D (const std::string& parentingMode); 208 /** @returns the Parenting mode of this node */ 209 int getParentMode2D() const { return this->parentMode; }; 210 211 // NULL_PARENT // 212 /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */ 213 static Element2D* getNullElement() { return (Element2D::nullElement != NULL)? Element2D::nullElement : Element2D::createNullElement(); }; 214 215 216 void update2D (float dt); 217 218 void debug2D (unsigned int depth = 1, unsigned int level = 0) const; 219 void debugDraw2D(unsigned int depth = 1, float size = 1.0, Vector color = Vector(1,0,0), unsigned int level = 0) const; 220 221 // helper functions // 222 static const char* parentingModeToString2D(int parentingMode); 223 static E2D_PARENT_MODE stringToParentingMode2D(const std::string& parentingMode); 224 225 static const char* layer2DToChar(E2D_LAYER layer); 226 static E2D_LAYER charToLayer2D(const std::string& layer); 227 228 static bool layerSortPredicate(const Element2D* elem1, const Element2D* elem2); 229 230 private: 231 void eraseChild2D(Element2D* child); 232 /** tells the child that the parent's Coordinate has changed */ 233 inline void parentCoorChanged2D () { this->bRelCoorChanged = true; } 234 /** tells the child that the parent's Direction has changed */ 235 inline void parentDirChanged2D () { this->bRelDirChanged = true; } 236 /** @returns the last calculated coordinate */ 237 inline Vector2D getLastAbsCoor2D() { return this->lastAbsCoordinate; } 238 239 void reparent2D(); 240 static Element2D* createNullElement(); 241 bool checkIntegrity(const Element2D* checkParent) const; 242 243 244 private: 245 const PNode* bindNode; //!< a node over which to display this 2D-element 246 Vector2D size; //!< The size of the rendered item 247 Vector2D* toSize; //!< The Size to iterate to. 248 249 E2D_ALIGNMENT alignment; //!< How the Element is aligned around its Position 250 251 bool bVisible; //!< If the given Element2D is visible. 252 bool bCurrentlyVisible; //!< Evaluated in the TICK process, to see if the Element is Currently visible. 253 bool bActive; //!< If the given Element2D is active. 254 E2D_LAYER layer; //!< What layer this Element2D is on. 255 256 bool bRelCoorChanged; //!< If Relative Coordinate has changed since last time we checked 257 bool bRelDirChanged; //!< If Relative Direction has changed since last time we checked 258 259 Vector2D relCoordinate; //!< coordinates relative to the parent 260 Vector2D absCoordinate; //!< absolute coordinates in the world ( from (0,0,0) ) 261 float relDirection; //!< direction relative to the parent 262 float absDirection; //!< absolute diretion in the world ( from (0,0,1) ) 263 264 Vector2D prevRelCoordinate; //!< The last Relative Coordinate from the last update-Cycle. 265 Vector2D lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 266 float prevRelDirection; //!< The last Relative Direciton from the last update-Cycle. 267 268 Vector2D velocity; //!< Saves the velocity. 269 270 Vector2D* toCoordinate; //!< a position to which to iterate. (This is used in conjunction with setParentSoft.and set*CoorSoft) 271 float* toDirection; //!< a direction to which to iterate. (This is used in conjunction with setParentSoft and set*DirSoft) 272 float bias; //!< how fast to iterate to the given position (default is 1) 273 274 Element2D* parent; //!< a pointer to the parent node 275 std::list<Element2D*> children; //!< list of the children of this Element2D 276 277 unsigned int parentMode; //!< the mode of the binding 278 279 static Element2D* nullElement; //!< The top-most Element 89 class Element2D : virtual public BaseObject 90 { 91 NewObjectListDeclaration(Element2D); 92 93 public: 94 Element2D(Element2D* parent = Element2D::getNullElement(), E2D_LAYER layer = E2D_DEFAULT_LAYER, short nodeFlags = E2D_PARENT_MODE_DEFAULT); 95 virtual ~Element2D(); 96 97 virtual void loadParams(const TiXmlElement* root); 98 99 // ACTIVATION // 100 inline void activate2D() { this->bActive = this->bRelCoorChanged = this->bRelDirChanged = true; }; 101 inline void deactivate2D() { this->bActive = false; }; 102 inline bool get2DActiveState() { return this->bActive; }; 103 104 // ALIGNMENT // 105 /** @param alignment the new Alignment of the 2D-Element */ 106 inline void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; }; 107 void setAlignment(const std::string& alignment); 108 inline E2D_ALIGNMENT getAlignment() const { return this->alignment; }; 109 110 // LAYERING // 111 void setLayer(E2D_LAYER layer); 112 void setLayer(const std::string& layer); 113 /** @returns the Layer this Element is drawn to */ 114 inline E2D_LAYER getLayer() const { return this->layer; }; 115 116 // VISIBILITY // 117 /** @param visible true if the Element should be visible false otherwise (will not be rendered) */ 118 inline void setVisibility(bool visible) { this->bVisible = visible; }; 119 /** @returns the visibility state */ 120 inline bool isVisible() const { return (this->bVisible && this->bCurrentlyVisible); }; 121 122 123 // POSITIONAL (E2D-specials) // 124 /** @param bindNode the Node this 2D-element should follow. if NULL the Element will not follow anything */ 125 void setBindNode(const PNode* bindNode); 126 void setBindNode(const std::string& bindNode); 127 inline const PNode* getBindNode() const { return this->bindNode; }; 128 129 inline void setSize2D(float x, float y) { this->size = Vector2D(x, y); }; 130 inline void setSize2D(const Vector2D& size) { this->size = size; }; 131 inline const Vector2D& getSize2D() const { return this->size; }; 132 void setSizeSoft2D(float x, float y, float bias = 1.0); 133 inline void setSizeX2D(float x) { this->size.x = x; }; 134 inline void setSizeY2D(float y) { this->size.y = y; }; 135 inline float getSizeX2D() const { return this->size.x; }; 136 inline float getSizeY2D() const { return this->size.y; }; 137 138 public: 139 virtual void tick(float dt) {}; 140 virtual void draw() const {}; 141 void tick2D(float dt); 142 void draw2D(E2D_LAYER from, E2D_LAYER to) const; 143 void drawChildren(E2D_LAYER from, E2D_LAYER to) const; 144 145 // LIKE PNODE 146 public: 147 void setRelCoor2D (const Vector2D& relCoord); 148 void setRelCoorX2D(float x); 149 void setRelCoorY2D(float y); 150 void setRelCoor2D (float x, float y); 151 void setRelCoor2Dpx (int x, int y); 152 void setRelCoorSoft2D (const Vector2D& relCoordSoft, float bias = 1.0); 153 void setRelCoorSoft2D (float x, float y, float bias = 1.0); 154 void setRelCoorSoft2Dpx (int x, int y, float bias = 1.0); 155 /** @returns the relative position */ 156 inline const Vector2D& getRelCoor2D () const { return this->prevRelCoordinate; }; 157 /** @returns the Relative Coordinate Destination */ 158 inline const Vector2D& getRelCoorSoft2D() const { return (this->toCoordinate)?*this->toCoordinate:this->relCoordinate; }; 159 const Vector2D& getRelCoor2Dpx() const; 160 void setAbsCoor2D (const Vector2D& absCoord); 161 void setAbsCoor2D (float x, float y); 162 void setAbsCoorX2D(float x); 163 void setAbsCoorY2D(float y); 164 void setAbsCoor2Dpx (int x, int y); 165 void setAbsCoorSoft2D (const Vector2D& absCoordSoft, float bias = 1.0); 166 void setAbsCoorSoft2D (float x, float y, float bias = 1.0); 167 /** @returns the absolute position */ 168 inline const Vector2D& getAbsCoor2D () const { return this->absCoordinate; }; 169 const Vector2D& getAbsCoor2Dpx () const; 170 171 void shiftCoor2D (const Vector2D& shift); 172 void shiftCoor2Dpx (int x, int y); 173 174 void setRelDir2D (float relDir); 175 void setRelDirSoft2D(float relDirSoft, float bias = 1.0); 176 /** @returns the relative Direction */ 177 inline float getRelDir2D () const { return this->prevRelDirection; }; 178 /** @returns the Relative Directional Destination */ 179 inline float getRelDirSoft2D() const { return (this->toDirection)?*this->toDirection:this->relDirection; }; 180 void setAbsDir2D (float absDir); 181 void setAbsDirSoft2D (float absDirSoft, float bias = 1.0); 182 /** @returns the absolute Direction */ 183 inline float getAbsDir2D () const { return this->absDirection; }; 184 void shiftDir2D (float shiftDir); 185 186 /** @returns the Speed of the Node */ 187 inline float getSpeed() const { return 0; }; 188 /** @returns the Velocity of the Node */ 189 inline const Vector2D& getVelocity() const { return this->velocity; }; 190 191 192 void addChild2D (Element2D* child); 193 void addChild2D (const std::string& childName); 194 void removeChild2D (Element2D* child); 195 void remove2D(); 196 197 /** @param parent the new parent of this Element2D */ 198 void setParent2D (Element2D* parent) { parent->addChild2D(this); }; 199 void setParent2D (const std::string& parentName); 200 /** @returns the parent of this Element2D */ 201 inline Element2D* getParent2D () const { return this->parent; }; 202 /** @returns the List of Children of this Element2D */ 203 inline const std::list<Element2D*>& getChildren2D() const { return this->children; }; 204 205 void setParentSoft2D(Element2D* parentNode, float bias = 1.0); 206 void setParentSoft2D(const std::string& parentName, float bias = 1.0); 207 208 void setParentMode2D (E2D_PARENT_MODE parentMode); 209 void setParentMode2D (const std::string& parentingMode); 210 /** @returns the Parenting mode of this node */ 211 int getParentMode2D() const { return this->parentMode; }; 212 213 // NULL_PARENT // 214 /** @returns the NullParent, the (main) ROOT of the PNode Tree. If it does not yet exist, it will be created. */ 215 static Element2D* getNullElement() { return (Element2D::nullElement != NULL)? Element2D::nullElement : Element2D::createNullElement(); }; 216 217 218 void update2D (float dt); 219 220 void debug2D (unsigned int depth = 1, unsigned int level = 0) const; 221 void debugDraw2D(unsigned int depth = 1, float size = 1.0, Vector color = Vector(1,0,0), unsigned int level = 0) const; 222 223 // helper functions // 224 static const char* parentingModeToString2D(int parentingMode); 225 static E2D_PARENT_MODE stringToParentingMode2D(const std::string& parentingMode); 226 227 static const char* layer2DToChar(E2D_LAYER layer); 228 static E2D_LAYER charToLayer2D(const std::string& layer); 229 230 static bool layerSortPredicate(const Element2D* elem1, const Element2D* elem2); 231 232 private: 233 void eraseChild2D(Element2D* child); 234 /** tells the child that the parent's Coordinate has changed */ 235 inline void parentCoorChanged2D () { this->bRelCoorChanged = true; } 236 /** tells the child that the parent's Direction has changed */ 237 inline void parentDirChanged2D () { this->bRelDirChanged = true; } 238 /** @returns the last calculated coordinate */ 239 inline Vector2D getLastAbsCoor2D() { return this->lastAbsCoordinate; } 240 241 void reparent2D(); 242 static Element2D* createNullElement(); 243 bool checkIntegrity(const Element2D* checkParent) const; 244 245 246 private: 247 const PNode* bindNode; //!< a node over which to display this 2D-element 248 Vector2D size; //!< The size of the rendered item 249 Vector2D* toSize; //!< The Size to iterate to. 250 251 E2D_ALIGNMENT alignment; //!< How the Element is aligned around its Position 252 253 bool bVisible; //!< If the given Element2D is visible. 254 bool bCurrentlyVisible; //!< Evaluated in the TICK process, to see if the Element is Currently visible. 255 bool bActive; //!< If the given Element2D is active. 256 E2D_LAYER layer; //!< What layer this Element2D is on. 257 258 bool bRelCoorChanged; //!< If Relative Coordinate has changed since last time we checked 259 bool bRelDirChanged; //!< If Relative Direction has changed since last time we checked 260 261 Vector2D relCoordinate; //!< coordinates relative to the parent 262 Vector2D absCoordinate; //!< absolute coordinates in the world ( from (0,0,0) ) 263 float relDirection; //!< direction relative to the parent 264 float absDirection; //!< absolute diretion in the world ( from (0,0,1) ) 265 266 Vector2D prevRelCoordinate; //!< The last Relative Coordinate from the last update-Cycle. 267 Vector2D lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 268 float prevRelDirection; //!< The last Relative Direciton from the last update-Cycle. 269 270 Vector2D velocity; //!< Saves the velocity. 271 272 Vector2D* toCoordinate; //!< a position to which to iterate. (This is used in conjunction with setParentSoft.and set*CoorSoft) 273 float* toDirection; //!< a direction to which to iterate. (This is used in conjunction with setParentSoft and set*DirSoft) 274 float bias; //!< how fast to iterate to the given position (default is 1) 275 276 Element2D* parent; //!< a pointer to the parent node 277 std::list<Element2D*> children; //!< list of the children of this Element2D 278 279 unsigned int parentMode; //!< the mode of the binding 280 281 static Element2D* nullElement; //!< The top-most Element 280 282 }; 281 283 -
branches/new_class_id/src/lib/graphics/render2D/image_plane.cc
r9406 r9685 21 21 22 22 #include "graphics_engine.h" 23 #include "glincl.h"24 23 #include "p_node.h" 25 24 26 25 26 #include "class_id.h" 27 CREATE_FACTORY(ImagePlane, CL_IMAGE_ENTITY); 27 28 28 29 30 CREATE_FACTORY(ImagePlane, CL_IMAGE_ENTITY); 29 NewObjectListDefinitionID(ImagePlane, CL_IMAGE_ENTITY); 31 30 32 31 … … 56 55 void ImagePlane::init() 57 56 { 58 this-> setClassID(CL_IMAGE_PLANE, "ImagePlane");57 this->registerObject(this, ImagePlane::_objectList); 59 58 this->setName("ImagePlane"); 60 59 -
branches/new_class_id/src/lib/graphics/render2D/image_plane.h
r7843 r9685 17 17 class ImagePlane : public Element2D 18 18 { 19 19 NewObjectListDeclaration(ImagePlane); 20 20 public: 21 21 ImagePlane(const TiXmlElement* root = NULL); -
branches/new_class_id/src/lib/graphics/render2D/render_2d.cc
r9406 r9685 19 19 20 20 #include "graphics_engine.h" 21 #include "class_list.h"22 21 #include "element_2d.h" 23 22 23 NewObjectListDefinition(Render2D); 24 24 25 25 … … 29 29 Render2D::Render2D () 30 30 { 31 this->setClassID(CL_RENDER_2D, "Render2D");32 31 this->registerObject(this, Render2D::_objectList); 32 this->setName("Render2D"); 33 33 34 34 this->showNodes = false; 35 35 } 36 36 -
branches/new_class_id/src/lib/graphics/render2D/render_2d.h
r7840 r9685 12 12 13 13 //! A default singleton class. 14 class Render2D : public BaseObject { 14 class Render2D : public BaseObject 15 { 16 NewObjectListDeclaration(Render2D); 17 15 18 friend class Element2D; 16 19 17 18 19 20 20 public: 21 virtual ~Render2D(); 22 /** @returns a Pointer to the only object of this Class */ 23 inline static Render2D* getInstance() { if (!singletonRef) singletonRef = new Render2D(); return singletonRef; }; 21 24 22 25 void toggleNodesVisibility() { this->showNodes = !this->showNodes; }; 23 26 24 25 26 27 void update(float dt); 28 void tick(float dt); 29 void draw(E2D_LAYER from, E2D_LAYER to) const; 27 30 28 29 30 31 private: 32 Render2D(); 33 static Render2D* singletonRef; //!< Reference to this class. 31 34 32 33 35 bool showNodes; //!< If the debug-Nodes should be visible 36 }; 34 37 35 38 #endif /* _RENDER_2D_H */ -
branches/new_class_id/src/lib/graphics/shader.cc
r9406 r9685 33 33 34 34 35 35 NewObjectListDefinition(Shader); 36 36 37 37 /** … … 40 40 Shader::Shader (const std::string& vertexShaderFile, const std::string& fragmentShaderFile) 41 41 { 42 this->setClassID(CL_SHADER, "Shader"); 43 42 this->registerObject(this, Shader::_objectList); 44 43 this->shaderProgram = 0; 45 44 this->vertexShader = 0; -
branches/new_class_id/src/lib/graphics/shader.h
r8255 r9685 19 19 class Shader : public BaseObject 20 20 { 21 NewObjectListDeclaration(Shader); 21 22 public: 22 23 class Uniform … … 42 43 { 43 44 case 1: 44 45 45 glUniform1fv(this->uniform, 1, vv); 46 break; 46 47 case 2: 47 48 48 glUniform2fv(this->uniform, 2, vv); 49 break; 49 50 case 3: 50 51 51 glUniform3fv(this->uniform, 3, vv); 52 break; 52 53 case 4: 53 54 54 glUniform4fv(this->uniform, 4, vv); 55 break; 55 56 } 56 57 } … … 60 61 { 61 62 case 1: 62 63 63 glUniform1iv(this->uniform, 1, vv); 64 break; 64 65 case 2: 65 66 66 glUniform2iv(this->uniform, 2, vv); 67 break; 67 68 case 3: 68 69 69 glUniform3iv(this->uniform, 3, vv); 70 break; 70 71 case 4: 71 72 72 glUniform4iv(this->uniform, 4, vv); 73 break; 73 74 } 74 75 } 75 76 private: 76 77 GLint uniform; 77 78 }; … … 99 100 static void deactivateShader(); 100 101 101 102 Shader::Uniform getUniform(const std::string& location) { return Shader::Uniform(this, location); } 102 103 103 104 bool loadShaderProgramm(Shader::Type type, const std::string& fileName); … … 118 119 119 120 120 121 GLhandleARB getProgram() const { return this->shaderProgram; } 121 122 GLhandleARB getVertexS() const { return this->vertexShader; } 122 123 GLhandleARB getFragmentS() const { return this->fragmentShader; } -
branches/new_class_id/src/lib/graphics/spatial_separation/quadtree.cc
r9406 r9685 27 27 #define QUADTREE_MATERIAL_COUNT 4 28 28 29 NewObjectListDefinition(Quadtree); 29 30 /** 30 31 * standard constructor … … 32 33 Quadtree::Quadtree (const modelInfo* pModelInfo, const int treeDepth) 33 34 { 34 this-> setClassID(CL_QUADTREE, "Quadtree");35 this->registerObject(this, Quadtree::_objectList); 35 36 this->pModelInfo = pModelInfo; 36 37 this->treeDepth = treeDepth; -
branches/new_class_id/src/lib/graphics/spatial_separation/quadtree.h
r6022 r9685 21 21 //! A class for quadtree separation of the world 22 22 class Quadtree : public BaseObject { 23 23 NewObjectListDeclaration(Quadtree); 24 24 25 25 public: -
branches/new_class_id/src/lib/graphics/spatial_separation/quadtree_node.cc
r9406 r9685 27 27 28 28 29 29 NewObjectListDefinition(QuadtreeNode); 30 30 31 31 /** … … 102 102 void QuadtreeNode::init() 103 103 { 104 this-> setClassID(CL_QUADTREE_NODE, "QuadtreeNode");104 this->registerObject(this, QuadtreeNode::_objectList); 105 105 106 106 /* init the rest of the variables for both init types */ -
branches/new_class_id/src/lib/graphics/spatial_separation/quadtree_node.h
r6617 r9685 26 26 //! A class for a Quadtree Node representation 27 27 class QuadtreeNode : public BaseObject { 28 NewObjectListDeclaration(QuadtreeNode); 28 29 29 30 public: -
branches/new_class_id/src/lib/graphics/spatial_separation/spatial_separation.cc
r9406 r9685 24 24 25 25 26 26 NewObjectListDefinition(SpatialSeparation); 27 27 28 28 /** 29 * standard constructor29 * @brief standard constructor 30 30 * @param model the model that is to be separated 31 31 * @param overlapSize each box will overlap for a given size 32 33 34 32 * 33 * The boxes are overlaping because this makes collision detection a lot simpler 34 * 35 35 */ 36 36 SpatialSeparation::SpatialSeparation (Model* model, float overlapSize) … … 39 39 PRINT(3)("+-| (Event) Spatial Separation process kicked on\n"); 40 40 41 this-> setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");41 this->registerObject(this, SpatialSeparation::_objectList); 42 42 /* debug vice */ 43 43 this->createQuadtree(model); … … 46 46 47 47 /** 48 * standard constructor48 * @brief standard constructor 49 49 * @param model the model that is to be separated 50 50 * @param overlapSize each box will overlap for a given size … … 54 54 SpatialSeparation::SpatialSeparation (Model* model, Model* playerModel) 55 55 { 56 this-> setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");56 this->registerObject(this, SpatialSeparation::_objectList); 57 57 58 58 } … … 60 60 61 61 /** 62 * standard deconstructor62 * @brief standard deconstructor 63 63 */ 64 64 SpatialSeparation::~SpatialSeparation () … … 70 70 71 71 /** 72 * creates a quadtree72 * @brief creates a quadtree 73 73 * @param model the model to do a quadtree on 74 74 * @param minLength the minimal length of a quadtree node … … 83 83 84 84 /** 85 * 85 * @brief creates a quadtree 86 86 * @param model the model to do a quadtree on 87 87 * @param minLength the minimal length of a quadtree node … … 95 95 96 96 /** 97 * creates a quadtree97 * @brief creates a quadtree 98 98 * @param model the model to do a quadtree on 99 99 * @param minLength the minimal length of a quadtree node … … 109 109 110 110 /** 111 * draws all the quadtrees111 * @brief draws all the quadtrees 112 112 */ 113 113 void SpatialSeparation::drawQuadtree() … … 118 118 this->quadtree->drawTree(); 119 119 } 120 121 122 123 124 125 126 127 128 129 130 131 -
branches/new_class_id/src/lib/graphics/spatial_separation/spatial_separation.h
r6022 r9685 19 19 //! A class for spatial separation of vertices based arrays 20 20 class SpatialSeparation : public BaseObject { 21 NewObjectListDeclaration(SpatialSeparation); 21 22 22 23 public: -
branches/new_class_id/src/lib/graphics/text_engine/font.cc
r8989 r9685 29 29 #include "compiler.h" 30 30 31 NewObjectListDefinition(Font); 31 32 32 33 Font::Font() … … 130 131 this->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 131 132 132 this-> setClassID(CL_FONT, "Font");133 this->registerObject(this, Font::_objectList); 133 134 if (Font::defaultFontData.get() == NULL) 134 135 { -
branches/new_class_id/src/lib/graphics/text_engine/font.h
r8766 r9685 19 19 class Font : public Material 20 20 { 21 NewObjectListDeclaration(Font); 21 22 22 23 public: -
branches/new_class_id/src/lib/graphics/text_engine/limited_width_text.cc
r9406 r9685 19 19 #include "font.h" 20 20 21 NewObjectListDefinition(LimitedWidthText); 21 22 /** 22 23 * @brief creates a new Text Element … … 27 28 : Text(fontFile, textSize) 28 29 { 29 this-> setClassID(CL_LIMITED_WIDTH_TEXT, "LimitedWidthText");30 this->registerObject(this, LimitedWidthText::_objectList); 30 31 31 32 this->_dotsPosition = End; -
branches/new_class_id/src/lib/graphics/text_engine/limited_width_text.h
r8980 r9685 14 14 class LimitedWidthText : public Text 15 15 { 16 NewObjectListDeclaration(LimitedWidthText); 16 17 public: 17 18 typedef enum { -
branches/new_class_id/src/lib/graphics/text_engine/multi_line_text.cc
r9406 r9685 19 19 #include "font.h" 20 20 21 NewObjectListDefinition(MultiLineText); 22 21 23 /** 22 24 * @brief creates a new Text Element … … 27 29 : Text(fontFile, textSize) 28 30 { 29 this-> setClassID(CL_MULTI_LINE_TEXT, "MultiLineText");31 this->registerObject(this, MultiLineText::_objectList); 30 32 31 33 this->lineSpacing = 1.0; -
branches/new_class_id/src/lib/graphics/text_engine/multi_line_text.h
r7757 r9685 14 14 class MultiLineText : public Text 15 15 { 16 NewObjectListDeclaration(MultiLineText); 16 17 public: 17 18 MultiLineText(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE, float lineWidth = 100.0); -
branches/new_class_id/src/lib/graphics/text_engine/text.cc
r9406 r9685 22 22 #include "debug.h" 23 23 24 NewObjectListDefinition(Text); 25 24 26 /** 25 27 * @brief creates a new Text Element … … 30 32 // : _font(fontFile, FONT_DEFAULT_RENDER_SIZE) 31 33 { 32 this-> setClassID(CL_TEXT, "Text");34 this->registerObject(this, Text::_objectList); 33 35 34 36 // initialize this Text … … 44 46 : _font() 45 47 { 46 this-> setClassID(CL_TEXT, "Text");48 this->registerObject(this, Text::_objectList); 47 49 48 50 *this = text; -
branches/new_class_id/src/lib/graphics/text_engine/text.h
r8764 r9685 26 26 class Text : public Element2D 27 27 { 28 NewObjectListDeclaration(Text); 28 29 public: 29 30 Text(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE); -
branches/new_class_id/src/lib/graphics/text_engine/text_engine.cc
r9406 r9685 34 34 #include "graphics_engine.h" 35 35 #include "util/loading/resource_manager.h" 36 #include "class_list.h"37 36 38 37 #include "debug.h" … … 40 39 /// TEXT-ENGINE /// 41 40 /////////////////// 41 NewObjectListDefinition(TextEngine); 42 42 /** 43 43 * standard constructor … … 45 45 TextEngine::TextEngine () 46 46 { 47 this->setClassID(CL_TEXT_ENGINE, "TextEngine");48 49 47 this->registerObject(this, TextEngine::_objectList); 48 this->setName("TextEngine"); 49 this->enableFonts(); 50 50 } 51 51 … … 62 62 { 63 63 // first remove all the remaining Texts (if any). 64 const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT); 65 if (textList != NULL) 66 { 67 while(textList->size() > 0) 68 delete dynamic_cast<Text*>(textList->front()); 69 } 64 while (!Text::objectList().empty()) 65 delete Text::objectList().front(); 70 66 // delete all remaining fonts (There should not be Anything to do here) 71 const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT); 72 if (fontList != NULL) 67 68 //const std::list<BaseObject*>* fontList = ClassList::getList(CL_FONT); 69 //if (fontList != NULL) 73 70 { 74 71 ///FIXME 75 // while (fontList->size() > 0)72 // while (fontList->size() > 0) 76 73 { 77 // Font* font = dynamic_cast<Font*>(fontList->back());74 // Font* font = dynamic_cast<Font*>(fontList->back()); 78 75 //if (likely(font != Font::getDefaultFont())) 79 76 // ResourceManager::getInstance()->unload(font, RP_GAME); … … 91 88 { 92 89 if (!TTF_WasInit()) 93 94 95 90 { 91 if(TTF_Init()==-1) 92 PRINTF(1)("TTF_Init: %s\n", TTF_GetError()); 96 93 97 98 94 TextEngine::checkVersion(); 95 } 99 96 else 100 97 PRINTF(4)("Fonts already initialized\n"); … … 107 104 { 108 105 if (TTF_WasInit()) 109 110 // Font::removeDefaultFont();111 112 106 { 107 // Font::removeDefaultFont(); 108 TTF_Quit(); 109 } 113 110 else 114 111 PRINTF(4)("Fonts were not initialized.\n"); … … 122 119 void TextEngine::debug() const 123 120 { 124 const std::list<BaseObject*>* textList = ClassList::getList(CL_TEXT); 125 if (textList != NULL) 121 PRINT(0)("+-------------------------------+\n"); 122 PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n"); 123 PRINT(0)("+-------------------------------+\n"); 124 PRINT(0)("Reference: %p; Text Counts: %d\n", this, Text::objectList().size()); 125 126 for (NewObjectList<Text>::const_iterator it = Text::objectList().begin(); 127 it != Text::objectList().end(); 128 ++it) 126 129 { 127 PRINT(0)("+-------------------------------+\n"); 128 PRINT(0)("+ TEXT ENGINE DEBUG INFORMATION +\n"); 129 PRINT(0)("+-------------------------------+\n"); 130 PRINT(0)("Reference: %p; Text Counts: %d\n", this, textList->size()); 131 132 std::list<BaseObject*>::const_iterator text; 133 for ( text = textList->begin(); text != textList->end(); text++) 134 dynamic_cast<Text*>(*text)->debug(); 130 (*it)->debug(); 135 131 PRINT(0)("+---------------------------TE--+\n"); 136 132 } … … 152 148 compile_version.minor == link_version.minor && 153 149 compile_version.patch == link_version.patch) 154 155 156 150 { 151 return true; 152 } 157 153 else 158 159 160 161 162 154 { 155 PRINTF(2)("compiled with SDL_ttf version: %d.%d.%d\n", 156 compile_version.major, 157 compile_version.minor, 158 compile_version.patch); 163 159 164 165 166 167 168 169 160 PRINTF(2)("running with SDL_ttf version: %d.%d.%d\n", 161 link_version.major, 162 link_version.minor, 163 link_version.patch); 164 return false; 165 } 170 166 } -
branches/new_class_id/src/lib/graphics/text_engine/text_engine.h
r5515 r9685 24 24 class TextEngine : public BaseObject 25 25 { 26 public: 26 NewObjectListDeclaration(TextEngine); 27 public: 27 28 virtual ~TextEngine(); 28 29 /** @returns a Pointer to the only object of this Class */ -
branches/new_class_id/src/lib/lang/new_class_id.cc
r9681 r9685 17 17 18 18 #include "new_class_id.h" 19 #include <cassert>20 #include "debug.h"21 22 ///////////////////////////////////////////////////////////23 //// CLASS ID definiton. //////////////////////////////////24 ///////////////////////////////////////////////////////////25 /**26 * @brief standard constructor27 */28 NewClassID::NewClassID ()29 {}30 31 32 /**33 * @brief standard deconstructor34 */35 NewClassID::~NewClassID ()36 {37 ClassList::iterator it;38 for (it = this->_classes.begin(); it != this->_classes.end(); ++it)39 {40 (*it)._objectList->unregisterObject((*it)._iterator);41 delete (*it)._iterator;42 }43 }44 45 46 /**47 * @brief Seeks in the Inheritance if it matches objectList.48 * @param objectList The ObjectList this should be a member of (by Pointer-comparison).49 * @return True if found, false if not.50 */51 bool NewClassID::isA(const NewObjectListBase& objectList) const52 {53 ClassList::const_iterator it;54 for (it = this->_classes.begin(); it != this->_classes.end(); ++it)55 if ((*it)._objectList == &objectList)56 return true;57 return false;58 }59 60 /**61 * @brief Seeks in the Inheritance if it matches objectList.62 * @param classID The ClassID of the class this should be a member of.63 * @return True if found, false if not.64 */65 bool NewClassID::isA(int classID) const66 {67 ClassList::const_iterator it;68 for (it = this->_classes.begin(); it != this->_classes.end(); ++it)69 if (*(*it)._objectList == classID)70 return true;71 return false;72 }73 74 /**75 * @brief Seeks in the Inheritance if it matches objectList.76 * @param className The ClassName of the class this should be a member of.77 * @return True if found, false if not.78 */79 bool NewClassID::isA(const std::string& className) const80 {81 ClassList::const_iterator it;82 for (it = this->_classes.begin(); it != this->_classes.end(); ++it)83 if (*(*it)._objectList == className)84 return true;85 return false;86 }87 88 89 void NewClassID::listInheritance() const90 {91 PRINT(0)("Listing inheritance diagram for ....: ");92 ClassList::const_iterator it;93 for (it = this->_classes.begin(); it != this->_classes.end(); ++it)94 PRINT(0)(" -> %s(id:%d)", (*it)._objectList->name().c_str(), (*it)._objectList->id());95 PRINT(0)("\n");96 97 } -
branches/new_class_id/src/lib/lang/new_class_id.h
r9682 r9685 8 8 #define _NEW_CLASS_ID_H 9 9 10 #include "new_object_list.h"11 12 10 #include <string> 13 #include <list>14 11 15 12 //! A class to dynamically allocate ClassID's and support a isA operator … … 17 14 { 18 15 public: 19 NewClassID(); 20 ~NewClassID(); 16 NewClassID() : _id(-1), _name("") { }; 17 NewClassID(int id, const std::string& name) : _id(id), _name(name) { }; 18 // the copy constructor is also defined. 19 int id() const { return _id; }; 20 const std::string& name() const { return _name; }; 21 21 22 /** @returns the ClassName of the Topmost Object of the ClassStack */ 23 inline const std::string& getClassName() const { return _classes.front()._objectList->name(); } 24 /** @returns the ID of the Topmost object of the ClassStack */ 25 inline int leafClassID() const { return _classes.front()._objectList->id(); } 26 27 template<class T> void registerObject(T* object, NewObjectList<T>& list); 28 bool isA(const NewObjectListBase& objectList) const; 29 bool isA(int classID) const; 30 bool isA(const std::string& className) const; 31 32 void listInheritance() const; 22 bool operator==(NewClassID id) const { return _id == id._id || _name == id._name; }; 23 bool operator==(int id) const { return _id == id; }; 24 bool operator==(const std::string& name) const { return _name == name; }; 33 25 34 26 private: 35 ////////////////////////////// 36 //// Type Definition Part //// 37 ////////////////////////////// 38 //! A ClassEntry so we can store Classes inside of Objects 39 struct ClassEntry 40 { 41 /** Simple Constuctor @param objectList the NewObjectList, @param iterator the (intrusive) Iterator inside of the ObjectList */ 42 inline ClassEntry (NewObjectListBase* objectList, NewObjectListBase::IteratorBase* iterator) : _objectList(objectList), _iterator(iterator) {} 43 NewObjectListBase* _objectList; //!< A ObjectList this Object is part of 44 NewObjectListBase::IteratorBase* _iterator; //!< An iterator pointing to the position of the Object inside of the List. 45 }; 46 typedef std::list<ClassEntry> ClassList; //!< Type definition for the List. 47 48 ClassList _classes; //!< All Classes this object is part of. 27 int _id; 28 std::string _name; 49 29 }; 50 51 52 /**53 * @brief Registeres an Object of Type T to objectList54 * @param object The Object to append to the objectList.55 * @param objectList The ObjectList to append the Object to.56 *57 * This function is essential to integrate objects into their designated ObjectList.58 * Remember if you do not want objects to be stored in Lists (less overhead),59 * do not attempt to call this function.60 */61 template<class T>62 inline void NewClassID::registerObject(T* object, NewObjectList<T>& objectList)63 {64 this->_classes.push_front(ClassEntry(&objectList, objectList.registerObject(object)));65 }66 67 30 #endif /* _NEW_CLASS_ID_H */ -
branches/new_class_id/src/lib/lang/new_object_list.cc
r9681 r9685 27 27 */ 28 28 NewObjectListBase::NewObjectListBase(const std::string& className, int id) 29 : _name(className)30 29 { 31 30 if (NewObjectListBase::_classesByID == NULL) … … 37 36 assert(!NewObjectListBase::classNameExists(className) && "Classes should only be included once, and no two classes should have the same name (key value)"); 38 37 39 if (id != -1)38 if (id == -1) 40 39 { 41 this->_id = id; 42 } 43 else 44 { 45 this->_id = NewObjectListBase::_classesByID->size(); 40 id = NewObjectListBase::_classesByID->size(); 46 41 // searching for a free ID 47 while (NewObjectListBase::classIDExists( _id)) ++id;42 while (NewObjectListBase::classIDExists(id)) ++id; 48 43 } 49 44 assert(!NewObjectListBase::classIDExists(id) && "Classes should only be included once, and no two classes should have the same ID (key value)"); … … 52 47 //std::cout << "register new ObjectList " << className << " ID: " << this->_id << std::endl; 53 48 54 (*NewObjectListBase::_classesByID)[this->_id] = this; 55 (*NewObjectListBase::_classesByName)[this->_name] = this; 49 this->_identity = NewClassID(id, className); 50 (*NewObjectListBase::_classesByID)[this->_identity.id()] = this; 51 (*NewObjectListBase::_classesByName)[this->_identity.name()] = this; 56 52 } 57 53 … … 70 66 std::cout << "SIZE OF _classByName: " << NewObjectListBase::_classesByName->size() << std::endl; 71 67 */ 72 NewObjectListBase::_classesBy Name->erase(this->_name);73 NewObjectListBase::_classesBy ID->erase(this->_id);68 NewObjectListBase::_classesByID->erase(this->_identity.id()); 69 NewObjectListBase::_classesByName->erase(this->_identity.name()); 74 70 75 71 if (NewObjectListBase::_classesByID->empty()) -
branches/new_class_id/src/lib/lang/new_object_list.h
r9684 r9685 8 8 #define _NEW_OBJECT_LIST_H 9 9 10 #include " type_info.h"10 #include "new_class_id.h" 11 11 #include <map> 12 12 #include <list> … … 40 40 41 41 public: 42 inline int id() const { return _id ; };43 inline const std::string& name() const { return _ name; };44 bool operator==(int id) const { return _id == id; };45 bool operator==(const std::string& name) const { return _ name== name; };42 inline int id() const { return _identity.id(); }; 43 inline const std::string& name() const { return _identity.name(); }; 44 bool operator==(int id) const { return _identity == id; }; 45 bool operator==(const std::string& name) const { return _identity == name; }; 46 46 47 47 virtual void debug() const = 0; … … 69 69 typedef std::map<std::string, NewObjectListBase*> classNameMap;//!< The Generic Map. 70 70 71 int _id; //!< The ID of the class. 72 std::string _name; //!< The Name of the Class. 71 NewClassID _identity; //!< The Identity of the Class (ID and Name). 73 72 74 73 private: … … 114 113 inline const list& objects() const { return _objects; }; 115 114 115 inline iterator begin() { return _objects.begin(); }; 116 inline const_iterator begin() const { return _objects.begin(); }; 117 inline iterator end() { return _objects.end(); }; 118 inline const_iterator end() const { return _objects.end(); }; 119 120 inline bool empty() const { return _objects.empty(); }; 121 inline int size() const { return _objects.size(); }; 122 inline T* front() const { return _objects.front(); }; 123 inline T* back() const { return _objects.back(); }; 124 116 125 NewObjectListBase::IteratorBase* registerObject(T* object); 117 126 void unregisterObject(IteratorBase* iterator); -
branches/new_class_id/src/lib/script_engine/script_class.h
r9003 r9685 34 34 virtual void registerClass(Script* script) = 0; 35 35 virtual int insertObject(Script* L, BaseObject* obj, bool gc=false) = 0; 36 virtual int insertObject(Script* L, BaseObject* obj, const std::string& name, bool gc=false) = 0; 36 virtual int insertObject(Script* L, BaseObject* obj, const std::string& name, bool gc=false) = 0; 37 37 38 38 const ScriptMethod* scriptMethods() const { return this->_scriptMethods; } -
branches/new_class_id/src/util/object_manager.h
r9656 r9685 90 90 const EntityList& getObjectList(OM_LIST listNumber) const { return this->objectLists[listNumber]; } 91 91 92 static void distanceFromObject(EntityList& entities, const PNode& center, float radius, ClassID classID);92 template <class T> static void distanceFromObject(EntityList& entities, const PNode& center, float radius, NewObjectList<T>& list); 93 93 94 94 void debug(OM_LIST omList, unsigned int level = 0) const; -
branches/new_class_id/src/world_entities/Makefile.am
r8994 r9685 21 21 projectiles/projectile.cc \ 22 22 \ 23 extendable.cc \ 23 24 power_ups/power_up.cc \ 24 25 power_ups/param_power_up.cc \ -
branches/new_class_id/src/world_entities/extendable.cc
r9683 r9685 1 /*! 2 * @file proto_class.h 3 * @brief Interface for Worldentities that can picku up powerups. 4 */ 1 #include "extendable.h" 5 2 6 #ifndef _EXTENDABLE_H 7 #define _EXTENDABLE_H 8 9 #include "base_object.h" 10 11 // FORWARD DECLARATION 12 class PowerUp; 13 14 #include "power_ups/power_up.h" 15 16 //! A class for ... 17 class Extendable : virtual public BaseObject { 18 19 public: 20 // virtual ~Extendable(); 21 virtual bool pickup(PowerUp* powerUp) { return false; }; 22 23 protected: 24 Extendable() { this->setClassID(CL_EXTENDABLE, "Extendable"); }; 25 26 private: 27 28 }; 29 30 #endif /* _EXTENDABLE_H */ 3 NewObjectListDefinition(Extendable); -
branches/new_class_id/src/world_entities/extendable.h
r6282 r9685 1 1 /*! 2 * @file proto_class.h3 * @brief Interface for Worldentities that can pick uup powerups.2 * @file extendable.h 3 * @brief Interface for Worldentities that can pick up powerups. 4 4 */ 5 5 … … 12 12 class PowerUp; 13 13 14 14 15 #include "power_ups/power_up.h" 15 16 //! A class for ... 16 //! A class for Extendable Entities 17 17 class Extendable : virtual public BaseObject { 18 NewObjectListDeclaration(Extendable); 18 19 19 20 public: 20 // virtual ~Extendable();21 21 virtual bool pickup(PowerUp* powerUp) { return false; }; 22 22 23 23 protected: 24 Extendable() { this->setClassID(CL_EXTENDABLE, "Extendable"); }; 25 26 private: 27 24 Extendable() { this->registerObject(this, Extendable::_objectList); }; 28 25 }; 29 26 -
branches/new_class_id/src/world_entities/weapons/ammo_container.h
r9684 r9685 19 19 20 20 public: 21 AmmoContainer( ClassID projectileType, float maxEnergy = DEFAULT_MAX_ENERGY);21 AmmoContainer(NewClassID id, float maxEnergy = DEFAULT_MAX_ENERGY); 22 22 virtual ~AmmoContainer(); 23 23 24 24 bool operator=(int projectileType) const { return (this->projectileType == projectileType); }; 25 ClassID getProjectileType() const { return this->projectileType; };25 NewClassID getProjectileType() const { return this->projectileType; }; 26 26 27 27 float increaseEnergy(float energy); … … 41 41 float maxEnergy; 42 42 43 ClassID projectileType;43 NewClassID projectileType; 44 44 }; 45 45 -
branches/new_class_id/src/world_entities/weapons/weapon.h
r8976 r9685 87 87 Weapon (); 88 88 virtual ~Weapon (); 89 static Weapon* createWeapon( ClassID weaponID);89 static Weapon* createWeapon(NewClassID weaponID); 90 90 91 91 void init(); … … 110 110 /** @returns the Capabilities of this Weapon */ 111 111 inline long getCapability() const { return this->capability; }; 112 void setProjectileType( ClassID projectile);112 void setProjectileType(NewClassID projectile); 113 113 void setProjectileTypeC(const std::string& projectile); 114 114 /** @returns The projectile's classID */ 115 inline ClassID getProjectileType() { return this->projectile; };115 inline NewClassID getProjectileType() { return this->projectile; }; 116 116 /** @returns the FastFactory, that creates Projectiles of type getProjectile */ 117 117 inline FastFactory* getProjectileFactory() { return this->projectileFactory; }; … … 230 230 bool chargeable; //!< if the Weapon is charcheable (if true, the weapon will charge before it fires.) 231 231 232 ClassID projectile; //!< the projectile used for this weapon (since they should be generated via macro and the FastFactory, only the ClassID must be known.)232 NewClassID projectile; //!< the projectile used for this weapon (since they should be generated via macro and the FastFactory, only the ClassID must be known.) 233 233 FastFactory* projectileFactory; //!< A factory, that produces and handles the projectiles. 234 234 }; -
branches/new_class_id/src/world_entities/weapons/weapon_manager.h
r8844 r9685 89 89 void changeWeaponConfig(int weaponConfig); 90 90 91 float increaseAmmunition( ClassID projectileType, float ammo);91 float increaseAmmunition(NewClassID projectileType, float ammo); 92 92 float inclreaseAmmunition(const Weapon* weapon, float ammo); 93 93 … … 106 106 // private: 107 107 int getNextFreeSlot(int configID, long capability = WTYPE_ALL); 108 CountPointer<AmmoContainer>& getAmmoContainer( ClassID projectileType);108 CountPointer<AmmoContainer>& getAmmoContainer(NewClassID projectileType); 109 109 CountPointer<AmmoContainer>& getAmmoContainer(const Weapon* weapon); 110 110
Note: See TracChangeset
for help on using the changeset viewer.