Changeset 9837 in orxonox.OLD for branches/new_class_id
- Timestamp:
- Sep 26, 2006, 5:22:12 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/graphics/text_engine
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/text_engine/font.h
r9718 r9837 52 52 void debug() const; 53 53 54 void acquireData(const FontData::Pointer& data) { this->data = data; }; 55 const FontData::Pointer& dataPointer() const { return data; }; 54 56 private: 55 57 void init(); -
branches/new_class_id/src/lib/graphics/text_engine/resource_texture.cc
r9833 r9837 1 1 2 #include "resource_ texture.h"2 #include "resource_font.h" 3 3 #include "substring.h" 4 4 #include "multi_type.h" … … 6 6 7 7 8 Resource Texture::ResourceTexture(const std::string& imageName, GLenum target)9 : NewResource(&Resource Texture::type)8 ResourceFont::ResourceFont(const std::string& imageName, GLenum target) 9 : NewResource(&ResourceFont::type) 10 10 { 11 11 Resources::StorePointer* ptr = this->acquireResource(imageName + ',' + "TEST"); … … 13 13 if (ptr) 14 14 { 15 PRINTF(5)("FOUND TEXTURE: %s\n", imageName.c_str());16 this->acquireData(static_cast<Resource Texture::TextureResourcePointer*>(ptr)->ptr());15 PRINTF(5)("FOUND FONT: %s\n", imageName.c_str()); 16 this->acquireData(static_cast<ResourceFont::FontResourcePointer*>(ptr)->ptr()); 17 17 } 18 18 else 19 19 { 20 PRINTF(5)("NOT FOUND TEXTURE: %s\n", imageName.c_str());20 PRINTF(5)("NOT FOUND FONT: %s\n", imageName.c_str()); 21 21 std::string fileName = this->NewResource::locateFile(imageName); 22 this-> Texture::loadImage(fileName, target);23 this->NewResource::addResource(new Resource Texture::TextureResourcePointer(imageName + ',' + "TEST", Resources::KeepLevel(0), this->Texture::dataPointer()));22 this->Font::loadImage(fileName, target); 23 this->NewResource::addResource(new ResourceFont::FontResourcePointer(imageName + ',' + "TEST", Resources::KeepLevel(0), this->Font::dataPointer())); 24 24 } 25 25 } 26 26 27 Resource Texture ResourceTexture::createFromString(const std::string& loadString)27 ResourceFont ResourceFont::createFromString(const std::string& loadString) 28 28 { 29 29 SubString loadValues(loadString, ','); 30 30 std::string imageName; 31 GLenum target = GL_ TEXTURE_2D;31 GLenum target = GL_FONT_2D; 32 32 if (loadValues.size() > 0) 33 33 imageName = loadValues[0]; … … 35 35 target = (GLenum)MultiType(loadValues[2]).getInt(); 36 36 37 return Resource Texture(imageName, target);37 return ResourceFont(imageName, target); 38 38 } 39 39 40 40 41 41 42 Resources::tType<Resource Texture> ResourceTexture::type("Texture");42 Resources::tType<ResourceFont> ResourceFont::type("Font"); 43 43 44 44 … … 46 46 47 47 48 Resource Texture::TextureResourcePointer::TextureResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const TextureData::Pointer& data)48 ResourceFont::FontResourcePointer::FontResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const FontData::Pointer& data) 49 49 : Resources::StorePointer(loadString, keepLevel) , pointer(data) 50 50 {} -
branches/new_class_id/src/lib/graphics/text_engine/resource_texture.h
r9833 r9837 1 1 /*! 2 * @file resource_ texture.h3 * @brief Contains the Resource Texture class, that handles the Resource-specific loading part of the Texture.2 * @file resource_font.h 3 * @brief Contains the ResourceFont class, that handles the Resource-specific loading part of the Font. 4 4 * 5 5 */ 6 6 7 #ifndef _RESOURCE_ TEXTURE_H8 #define _RESOURCE_ TEXTURE_H7 #ifndef _RESOURCE_FONT_H 8 #define _RESOURCE_FONT_H 9 9 10 10 #include "util/loading/resource.h" 11 #include " texture.h"11 #include "font.h" 12 12 13 13 14 class Resource Texture : public Texture, public Resources::NewResource14 class ResourceFont : public Font, public Resources::NewResource 15 15 { 16 16 public: 17 Resource Texture(const std::string& imageName, GLenum target = GL_TEXTURE_2D);18 static Resource TexturecreateFromString(const std::string& loadString);17 ResourceFont(const std::string& imageName, GLenum target = GL_FONT_2D); 18 static ResourceFont createFromString(const std::string& loadString); 19 19 20 20 private: 21 class TextureResourcePointer : public Resources::StorePointer21 class FontResourcePointer : public Resources::StorePointer 22 22 { 23 23 public: 24 TextureResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const TextureData::Pointer& data);25 inline const TextureData::Pointer& ptr() const { return pointer; }24 FontResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const FontData::Pointer& data); 25 inline const FontData::Pointer& ptr() const { return pointer; } 26 26 private: 27 TextureData::Pointer pointer;27 FontData::Pointer pointer; 28 28 }; 29 29 30 30 private: 31 static Resources::tType<Resource Texture> type;31 static Resources::tType<ResourceFont> type; 32 32 }; 33 33 34 34 35 #endif /* _RESOURCE_ TEXTURE_H */35 #endif /* _RESOURCE_FONT_H */
Note: See TracChangeset
for help on using the changeset viewer.