- Timestamp:
- Sep 1, 2006, 11:56:54 PM (18 years ago)
- Location:
- branches/new_class_id/src
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/importer/material.cc
r9715 r9718 324 324 * @param textureNumber The Texture-Number from 0 to GL_MAX_TEXTURE_UNITS 325 325 */ 326 void Material::setDiffuseMap(const TextureData Pointer& textureDataPointer, unsigned int textureNumber)326 void Material::setDiffuseMap(const TextureData::Pointer& textureDataPointer, unsigned int textureNumber) 327 327 { 328 328 assert(textureNumber < Material::getMaxTextureUnits()); -
branches/new_class_id/src/lib/graphics/importer/material.h
r9715 r9718 54 54 // MAPPING // 55 55 void setDiffuseMap(const Texture& texture, unsigned int textureNumber = 0); 56 void setDiffuseMap(const TextureData Pointer& texturePointer, unsigned int textureNumber = 0);56 void setDiffuseMap(const TextureData::Pointer& texturePointer, unsigned int textureNumber = 0); 57 57 void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0); 58 58 void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0); -
branches/new_class_id/src/lib/graphics/importer/texture.cc
r9715 r9718 151 151 this->registerObject(this, Texture::_objectList); 152 152 153 this->data = TextureData Pointer(new TextureData());153 this->data = TextureData::Pointer(new TextureData()); 154 154 155 155 this->priority = 0.5; … … 176 176 } 177 177 178 Texture& Texture::operator=(const TextureData Pointer& textureDataPointer)178 Texture& Texture::operator=(const TextureData::Pointer& textureDataPointer) 179 179 { 180 180 this->data = textureDataPointer; -
branches/new_class_id/src/lib/graphics/importer/texture.h
r9715 r9718 29 29 30 30 Texture& operator=(const Texture& texture); 31 Texture& operator=(const TextureData Pointer& textureDataPointer);31 Texture& operator=(const TextureData::Pointer& textureDataPointer); 32 32 33 33 virtual ~Texture(); … … 63 63 64 64 private: 65 TextureData Pointerdata; //!< The TextureData65 TextureData::Pointer data; //!< The TextureData 66 66 GLclampf priority; //!< the priority of the current texture (used for garphics cards with limited mem) 67 67 -
branches/new_class_id/src/lib/graphics/importer/texture_data.h
r8761 r9718 18 18 class TextureData 19 19 { 20 public: 21 typedef CountPointer<TextureData> Pointer; 20 22 public: 21 23 TextureData(); … … 43 45 }; 44 46 45 typedef CountPointer<TextureData> TextureDataPointer;46 47 47 #endif /* _TEXTURE_DATA_H */ -
branches/new_class_id/src/lib/graphics/text_engine/font.cc
r9715 r9718 139 139 } 140 140 141 FontData Pointer Font::defaultFontData(NULL);141 FontData::Pointer Font::defaultFontData(NULL); 142 142 143 143 /** … … 147 147 { 148 148 // temporarily create a Font. 149 Font::defaultFontData = FontData Pointer(new FontData);149 Font::defaultFontData = FontData::Pointer(new FontData); 150 150 // apply the Data. 151 151 Font::defaultFontData = Font(font_xpm).data; … … 160 160 bool Font::loadFontFromTTF(const std::string& fontFile, unsigned int renderSize) 161 161 { 162 this->data = FontData Pointer (new FontData());162 this->data = FontData::Pointer (new FontData()); 163 163 bool retVal = this->data->loadFontFromTTF(fontFile, renderSize); 164 164 if (!retVal) … … 175 175 bool Font::loadFontFromSDL_Surface(SDL_Surface* surface) 176 176 { 177 this->data = FontData Pointer (new FontData());177 this->data = FontData::Pointer (new FontData()); 178 178 bool retVal = this->data->loadFontFromSDL_Surface(surface); 179 179 if (!retVal) … … 197 197 198 198 199 void Font::setTexture(const TextureData Pointer& texDataPointer)199 void Font::setTexture(const TextureData::Pointer& texDataPointer) 200 200 { 201 201 this->setDiffuseMap(texDataPointer); -
branches/new_class_id/src/lib/graphics/text_engine/font.h
r9715 r9718 20 20 { 21 21 ObjectListDeclaration(Font); 22 22 public: 23 typedef FontData::Glyph Glyph; 23 24 public: 24 25 Font(); … … 40 41 41 42 /** @returns a Pointer to the Array of Glyphs */ 42 inline Glyph**getGlyphArray() const { return this->data->getGlyphArray(); };43 inline const Glyph* const * const getGlyphArray() const { return this->data->getGlyphArray(); }; 43 44 44 45 inline int getMaxHeight() const { return data->getMaxHeight(); }; … … 55 56 static void initDefaultFont(); 56 57 57 void setTexture(const TextureData Pointer& texDataPointer);58 void setTexture(const TextureData::Pointer& texDataPointer); 58 59 59 60 private: 60 FontData Pointerdata; //!< A Data-Pointer to a Font.61 FontData::Pointer data; //!< A Data-Pointer to a Font. 61 62 62 static FontData PointerdefaultFontData; //!< a default font, that is used, if other fonts were unable to be loaded.63 static FontData::Pointer defaultFontData; //!< a default font, that is used, if other fonts were unable to be loaded. 63 64 }; 64 65 -
branches/new_class_id/src/lib/graphics/text_engine/font_data.h
r8768 r9718 26 26 #define FONT_DEFAULT_RENDER_SIZE 50 //!< At what Resolution to render fonts. 27 27 28 class FontData 29 { 30 31 32 public: 33 28 34 //! A struct for handling glyphs 29 35 /** 30 36 * a Glyph is one letter of a certain font 31 37 */ 32 struct Glyph33 {38 struct Glyph 39 { 34 40 // Glyph-specific (size and so on) 35 Uint16 character; //!< The character36 float minX; //!< The minimum distance from the origin in X37 float maxX; //!< The maximum distance from the origin in X38 float minY; //!< The minimum distance from the origin in Y39 float maxY; //!< The maximum distance from the origin in Y40 float width; //!< The width of the Glyph41 float height; //!< The height of the Glyph42 float bearingX; //!< How much is right of the Origin43 float bearingY; //!< How much is above the Origin44 float advance; //!< How big a Glyph would be in monospace-mode41 Uint16 character; //!< The character 42 float minX; //!< The minimum distance from the origin in X 43 float maxX; //!< The maximum distance from the origin in X 44 float minY; //!< The minimum distance from the origin in Y 45 float maxY; //!< The maximum distance from the origin in Y 46 float width; //!< The width of the Glyph 47 float height; //!< The height of the Glyph 48 float bearingX; //!< How much is right of the Origin 49 float bearingY; //!< How much is above the Origin 50 float advance; //!< How big a Glyph would be in monospace-mode 45 51 46 GLfloat texCoord[4]; //!< Texture coordinates: 0:left, 1:right, 2: top, 3: bottom.47 };52 GLfloat texCoord[4]; //!< Texture coordinates: 0:left, 1:right, 2: top, 3: bottom. 53 }; 48 54 49 50 class FontData 51 { 55 typedef CountPointer<FontData> Pointer; 52 56 public: 53 57 FontData(); … … 61 65 62 66 /** @returns a Pointer to the Array of Glyphs */ 63 inline Glyph**getGlyphArray() const { return this->glyphArray; };67 inline const Glyph* const * const getGlyphArray() const { return this->glyphArray; }; 64 68 65 69 int getMaxHeight() const { return maxHeight; }; … … 68 72 69 73 /** @returns the Texture-Data of this FontData */ 70 const TextureData Pointer& textureData() const { return texData; };74 const TextureData::Pointer& textureData() const { return texData; }; 71 75 72 76 bool rebuild() { return texData->rebuild(); }; … … 91 95 int maxDescent; //!< Max Desent of the Font. 92 96 93 TextureData Pointer texData;97 TextureData::Pointer texData; 94 98 }; 95 99 96 typedef CountPointer<FontData> FontDataPointer;97 98 100 #endif /* _FONT_DATA_H */ -
branches/new_class_id/src/lib/graphics/text_engine/limited_width_text.cc
r9715 r9718 76 76 glRotatef(this->getAbsDir2D(), 0, 0, 1); 77 77 78 Glyph* tmpGlyph;78 const Font::Glyph* tmpGlyph; 79 79 float posX = 0.0f; 80 80 glBegin(GL_QUADS); -
branches/new_class_id/src/lib/graphics/text_engine/multi_line_text.cc
r9715 r9718 80 80 glRotatef(this->getAbsDir2D(), 0, 0, 1); 81 81 82 Glyph* tmpGlyph;82 const Font::Glyph* tmpGlyph; 83 83 float posX = 0.0f; 84 84 float posY = 0.0f; -
branches/new_class_id/src/lib/graphics/text_engine/text.cc
r9715 r9718 235 235 glRotatef(this->getAbsDir2D(), 0, 0, 1); 236 236 237 Glyph* tmpGlyph;237 const Font::Glyph* tmpGlyph; 238 238 float posX = 0.0f; 239 239 glBegin(GL_QUADS); -
branches/new_class_id/src/lib/lang/base_object.cc
r9715 r9718 28 28 */ 29 29 BaseObject::BaseObject(const std::string& objectName) 30 : _leafClassID(&BaseObject::classID())31 30 { 32 31 this->className = "BaseObject"; -
branches/new_class_id/src/lib/lang/base_object.h
r9716 r9718 48 48 inline const std::string& getClassName() const { return _classes.front()._objectList->name(); }; 49 49 50 inline const ClassID& getClassID() const { return *_leafClassID; }50 inline const ClassID& getClassID() const { return _classes.front()._objectList->identity(); } 51 51 /** @returns the ID of the Topmost object of the ClassStack */ 52 inline const int& getLeafClassID() const { return _ leafClassID->id(); }52 inline const int& getLeafClassID() const { return _classes.front()._objectList->identity().id(); } 53 53 54 54 bool isA(const ObjectListBase& objectList) const; … … 89 89 std::string className; //!< the name of the class 90 90 ClassList _classes; //!< All Classes this object is part of. 91 const ClassID* _leafClassID; //!< Topmost ClassID.92 91 }; 93 92 … … 105 104 inline void BaseObject::registerObject(T* object, ObjectList<T>& objectList) 106 105 { 107 this->_leafClassID = &objectList.identity();108 106 this->_classes.push_front(ClassEntry(&objectList, objectList.registerObject(object))); 109 107 } -
branches/new_class_id/src/lib/lang/object_list.h
r9716 r9718 72 72 virtual void getBaseObjectList(base_list* list) const = 0; 73 73 74 static const ClassID& retrieveIdentity(int id);75 static const ClassID& retrieveIdentity(const std::string& name);76 77 static const ObjectListBase* const getObjectList(int classID);78 static const ObjectListBase* const getObjectList(const std::string& className);79 static const ObjectListBase* const getObjectList(const ClassID& classID);74 static const ClassID& retrieveIdentity(int id); 75 static const ClassID& retrieveIdentity(const std::string& name); 76 77 static const ObjectListBase* const getObjectList(int classID); 78 static const ObjectListBase* const getObjectList(const std::string& className); 79 static const ObjectListBase* const getObjectList(const ClassID& classID); 80 80 81 81 static BaseObject* getBaseObject(int classID, const std::string& objectName); … … 115 115 116 116 private: 117 int _id; 117 int _id; //!< The Unique ID of the Class. 118 118 const std::string _name; //!< The Name of the Class. 119 ClassID _identity; //!< The Identity of the Class. (equal to _id and _name)119 ClassID _identity; //!< The Identity of the Class. (equal to _id and _name) 120 120 121 121 private: … … 169 169 { 170 170 public: 171 typedef std::list<T*> list; 172 typedef typename list::iterator iterator; 173 typedef typename list::const_iterator const_iterator; 174 175 171 typedef std::list<T*> list; //!< The list of Type T* (used for Objects in this ObjectList) 172 typedef typename list::iterator iterator; //!< The iterator for the List of type T (use with ObjectList<Type>::iterator) 173 typedef typename list::const_iterator const_iterator; //!< A constant iterator for the List of type T (use with ObjectList<Type>::const_iterator) 174 175 176 //! An iterator to store Objects in the BaseObject, and remove Objects fast. 176 177 class Iterator : public ObjectListBase::IteratorBase 177 178 { 178 179 public: 179 Iterator(iterator it) { _it = it; } 180 /** @brief creates an Iterator fast. @param it the Iterator. */ 181 inline Iterator(iterator it) { _it = it; } 182 /** @returns the Iterator */ 180 183 inline iterator& it() { return _it; } 181 typename ObjectList::iterator _it; 184 private: 185 typename ObjectList::iterator _it; //!< Stored Iterator 182 186 }; 183 187 … … 210 214 211 215 212 ObjectListBase::IteratorBase* registerObject(T* object);216 ObjectListBase::IteratorBase* registerObject(T* object); 213 217 virtual void unregisterObject(IteratorBase* iterator); 214 218 … … 288 292 */ 289 293 template <class T> 290 294 bool ObjectList<T>::exists(const T* const object) const 291 295 { 292 296 return (std::find(_objects.begin(), _objects.end(), object) != _objects.end()); -
branches/new_class_id/src/lib/util/loading/resource.cc
r9406 r9718 18 18 #include "resource.h" 19 19 20 20 ObjectListDefinition(Resource); 21 21 22 22 … … 26 26 Resource::Resource (const std::string& fileName) 27 27 { 28 // this->setClassID(CL_RESOURCE, "Resource");28 this->registerObject(this, Resource::_objectList); 29 29 30 30 } -
branches/new_class_id/src/lib/util/loading/resource.h
r9715 r9718 19 19 class Resource : virtual public BaseObject 20 20 { 21 ObjectListDeclaration(Resource); 21 22 public: 22 class Priority23 class KeepLevel 23 24 { 24 25 public: 25 void set PriorityName(unsigned int level, const std::string& name)26 void setKeepLevelName(unsigned int level, const std::string& name) 26 27 { 27 if (_ priorityName.size() <= level)28 _ priorityName.resize(level+1);29 _ priorityName[level] = name;28 if (_keepLevelName.size() <= level) 29 _keepLevelName.resize(level+1); 30 _keepLevelName[level] = name; 30 31 } 31 32 private: 32 std::vector<std::string> _ priorityName;33 std::vector<std::string> _keepLevelName; 33 34 }; 34 35 … … 46 47 std::vector<std::string> _resourceSubPaths; 47 48 std::vector<std::string> _fileExtensions; 48 49 49 }; 50 51 50 52 51 public: … … 60 59 61 60 private: 61 std::string _fileName; 62 MultiType _parameters[3]; //!< The Parameters given to this Resource. 63 Resource::KeepLevel _keepLevel; //!< The Priority of this resource. (can only be increased, so noone else will delete this) 62 64 63 static std::vector<std::vector<std::string> > _resourcePaths;64 65 65 static std::vector< std::string> _resourceClassNames;66 static std::vector<Resource::Type> _resourceTypes; 66 67 67 68 //! GLOBALS 68 static std::string _mainGlobalPath; 69 static std::vector<std::string> _globalPaths; 70 71 std::string fileName; 72 73 unsigned int referenceCount; //!< How many times this Resource has been loaded. 74 /// TODO REMOVE THIS: ResourceType type; //!< ResourceType of this Resource. 75 Resource::Priority prio; //!< The Priority of this resource. (can only be increased, so noone else will delete this) 76 77 MultiType param[3]; //!< The Parameters given to this Resource. 69 static std::string _mainGlobalPath; 70 static std::vector<std::string> _globalPaths; 78 71 }; 79 72 -
branches/new_class_id/src/proto/proto_class.cc
r9406 r9718 17 17 18 18 #include "proto_class.h" 19 ObjectListDefinition(ProtoClass); 19 20 20 21 … … 27 28 ProtoClass::ProtoClass () 28 29 { 29 this->setClassID(CL_PROTO_ID, "ProtoClass");30 this->registerObject(this, ProtoClass::_objectList); 30 31 31 32 /* If you make a new class, what is most probably the case when you write this file 32 33 don't forget to: 33 34 1. Add the new file new_class.cc to the ./src/Makefile.am 34 2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS35 35 36 36 Advanced Topics: -
branches/new_class_id/src/proto/proto_class.h
r4838 r9718 15 15 //! A class for ... 16 16 class ProtoClass : public BaseObject { 17 17 ObjectListDeclaration(ProtoClass); 18 18 public: 19 19 ProtoClass(); -
branches/new_class_id/src/proto/proto_singleton.cc
r9406 r9718 17 17 18 18 #include "proto_singleton.h" 19 20 21 19 ObjectListDefinition(ProtoSingleton); 22 20 23 21 /** … … 26 24 ProtoSingleton::ProtoSingleton () 27 25 { 28 this->setClassID(CL_PROTO_ID, "ProtoSingleton"); 29 this->setName("ProtoSingleton"); 30 31 /* If you make a new class, what is most probably the case when you write this file 32 don't forget to: 33 1. Add the new file new_class.cc to the ./src/Makefile.am 34 2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS 35 !!!!!!!!!! IMPORTANT FOR SINGLETON !!!!!!!!!!!!!!!! 36 3. SingleTon MUST be CL_NEW_CLASS = 0x00000fxx 37 38 Advanced Topics: 39 - if you want to let your object be managed via the ObjectManager make sure to read 40 the object_manager.h header comments. You will use this most certanly only if you 41 make many objects of your class, like a weapon bullet. 42 */ 26 this->registerObject(this, ProtoSingleton::_objectList); 27 this->setName("ProtoSingleton"); 43 28 } 44 29 -
branches/new_class_id/src/proto/proto_singleton.h
r5405 r9718 13 13 //! A default singleton class. 14 14 class ProtoSingleton : public BaseObject { 15 ObjectListDeclaration(ProtoSingleton); 16 15 17 16 18 public:
Note: See TracChangeset
for help on using the changeset viewer.