Changeset 9837 in orxonox.OLD for branches/new_class_id/src/lib/graphics/text_engine/resource_texture.cc
- Timestamp:
- Sep 26, 2006, 5:22:12 PM (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
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 {}
Note: See TracChangeset
for help on using the changeset viewer.