- Timestamp:
- Mar 10, 2006, 1:56:40 AM (19 years ago)
- Location:
- branches/std/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/lib/graphics/importer/md2Model.cc
r7207 r7208 513 513 } 514 514 515 this->skinFileName = fileName;515 this->skinFileName = fileName; 516 516 517 517 this->material.setName("md2ModelMaterial"); -
branches/std/src/lib/graphics/importer/media_container.cc
r7203 r7208 34 34 * Default constructor 35 35 */ 36 MediaContainer::MediaContainer(const char*filename)36 MediaContainer::MediaContainer(const std::string& filename) 37 37 { 38 38 // set the class id for the base object … … 41 41 fps = 0; 42 42 mediaLoaded = false; 43 44 this->loadMedia(filename);43 if (!filename.empty()) 44 this->loadMedia(filename); 45 45 } 46 46 … … 84 84 } 85 85 86 bool MediaContainer::loadMedia(const char*filename)86 bool MediaContainer::loadMedia(const std::string& filename) 87 87 { 88 88 this->unloadMedia(); 89 89 90 if(filename == NULL)90 if(filename.empty()) 91 91 return false; 92 92 // check whether file exists 93 93 if(!ResourceManager::isInDataDir(filename)) 94 94 { 95 PRINTF(1)("Could not find %s\n", filename );95 PRINTF(1)("Could not find %s\n", filename.c_str()); 96 96 return false; 97 97 } -
branches/std/src/lib/graphics/importer/media_container.h
r6981 r7208 44 44 public: 45 45 46 MediaContainer(const char*filename = NULL);46 MediaContainer(const std::string& filename = NULL); 47 47 virtual ~MediaContainer(); 48 48 49 bool loadMedia(const char*filename);49 bool loadMedia(const std::string& filename); 50 50 void loadFrames(); 51 51 -
branches/std/src/lib/graphics/importer/movie_player.cc
r7203 r7208 42 42 mediaLoaded = false; 43 43 44 this->loadMovie(filename);45 44 if (!filename.empty()) 45 this->loadMovie(filename); 46 46 } 47 47 -
branches/std/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.cc
r7193 r7208 87 87 * @param backImageName name of the backgroun-image 88 88 */ 89 void GLMenuImageScreen::setBackgroundImage (const char*backImageName)89 void GLMenuImageScreen::setBackgroundImage (const std::string& backImageName) 90 90 { 91 91 this->backMat->setDiffuseMap(backImageName); … … 130 130 * @param barImage An image for the Bar 131 131 */ 132 void GLMenuImageScreen::setBarImage(const char*barImage)132 void GLMenuImageScreen::setBarImage(const std::string& barImage) 133 133 { 134 134 this->barMat->setDiffuseMap(barImage); -
branches/std/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.h
r6512 r7208 13 13 14 14 //! A class to display a loadScreen 15 class GLMenuImageScreen : public BaseObject { 15 class GLMenuImageScreen : public BaseObject 16 { 16 17 17 18 public: 18 19 GLMenuImageScreen (const TiXmlElement* root = NULL); 19 20 virtual void loadParams(const TiXmlElement* root); … … 22 23 void draw(); 23 24 24 void setBackgroundImage(const char*backImageName);25 void setBackgroundImage(const std::string& backImageName); 25 26 void setPosition(float offsetX, float offsetY); 26 27 void setScale (float scaleX, float scaleY); 27 28 void setPosScale(float offsetX, float offsetY, float scaleX, float scaleY); 28 29 29 void setBarImage(const char*barImage);30 void setBarImage(const std::string& barImage); 30 31 void setBarPosScale(float barX, float barY, float barW, float barH); 31 32 … … 39 40 40 41 41 42 private: 42 43 // background image 43 char*backImageName; //!< the name of the file of the background image44 std::string backImageName; //!< the name of the file of the background image 44 45 float offsetX; //!< X-offset of the the image from the left 45 46 float offsetY; //!< Y-offset of the image from the top -
branches/std/src/lib/util/loading/resource_manager.cc
r7207 r7208 324 324 const MultiType& param0, const MultiType& param1, const MultiType& param2) 325 325 { 326 327 printf("LOADING:::::: %s\n", fileName.c_str()); 326 328 // searching if the resource was loaded before. 327 329 Resource* tmpResource; -
branches/std/src/story_entities/movie_loader.cc
r7193 r7208 36 36 } 37 37 38 MovieLoader::~MovieLoader() 38 MovieLoader::~MovieLoader() 39 39 { 40 40 delete this->movie_player; … … 56 56 } 57 57 58 void MovieLoader::loadMovie(const char*filename)58 void MovieLoader::loadMovie(const std::string& filename) 59 59 { 60 60 movie_player->loadMovie(filename); … … 78 78 79 79 this->movie_player->start(0); 80 80 81 81 this->isRunning = true; 82 82 this->run(); … … 139 139 140 140 // calculate time difference in milliseconds (Uint32) 141 this->dt = currentFrame - this->lastFrame; 141 this->dt = currentFrame - this->lastFrame; 142 142 // calculate time difference in seconds (float) 143 143 this->dts = (float)this->dt / 1000.0f; -
branches/std/src/story_entities/movie_loader.h
r7022 r7208 43 43 44 44 private: 45 void loadMovie(const char*filename);45 void loadMovie(const std::string& filename); 46 46 void setFPS(float fps); 47 47 void tick(); -
branches/std/src/world_entities/movie_entity.cc
r7193 r7208 74 74 } 75 75 76 void MovieEntity::loadMovie(const char*filename)76 void MovieEntity::loadMovie(const std::string& filename) 77 77 { 78 78 if(media_container->loadMedia(filename)) -
branches/std/src/world_entities/movie_entity.h
r7010 r7208 37 37 virtual void loadParams(const TiXmlElement* root); 38 38 39 void loadMovie(const char*filename);39 void loadMovie(const std::string& filename); 40 40 void setAxis(float axis); 41 41 void setRotation(float rotation); -
branches/std/src/world_entities/skybox.cc
r7193 r7208 38 38 * @param fileName the file to take as input for the SkyBox 39 39 */ 40 SkyBox::SkyBox(const char*fileName)40 SkyBox::SkyBox(const std::string& fileName) 41 41 { 42 42 this->preInit(); 43 if ( fileName)43 if (!fileName.empty()) 44 44 this->setTextureAndType(fileName, ".jpg"); 45 45 this->postInit(); … … 89 89 this->setParentMode(PNODE_MOVEMENT); 90 90 91 this->textureName = NULL;91 this->textureName = ""; 92 92 } 93 93 … … 106 106 for (int i = 0; i < 6; i++) 107 107 { 108 if (this->material[i])108 if (this->material[i]) 109 109 delete this->material[i]; 110 if (this->cubeTexture[i])110 if (this->cubeTexture[i]) 111 111 ResourceManager::getInstance()->unload(this->cubeTexture[i]); 112 112 } 113 113 } 114 115 void SkyBox::setTexture(const std::string& name) 116 { 117 this->textureName = name; 118 this->setTextureAndType (name, "jpg"); 119 }; 120 114 121 115 122 /** … … 122 129 "skybox_right.jpg", "skybox_front.jpg", "skybox_back.jpg"); 123 130 */ 124 void SkyBox::setTextureAndType(const char* name, const char* extension) 125 { 126 char* top = new char[strlen(name)+strlen(extension)+ 10]; 127 char* bottom = new char[strlen(name)+strlen(extension)+ 10]; 128 char* left = new char[strlen(name)+strlen(extension)+ 10]; 129 char* right = new char[strlen(name)+strlen(extension)+ 10]; 130 char* front = new char[strlen(name)+strlen(extension)+ 10]; 131 char* back = new char[strlen(name)+strlen(extension)+ 10]; 132 133 sprintf(top, "%s_top.%s", name, extension); 134 sprintf(bottom, "%s_bottom.%s", name, extension); 135 sprintf(left, "%s_left.%s", name, extension); 136 sprintf(right, "%s_right.%s", name, extension); 137 sprintf(front, "%s_front.%s", name, extension); 138 sprintf(back, "%s_back.%s", name, extension); 131 void SkyBox::setTextureAndType(const std::string& name, const std::string& extension) 132 { 133 std::string top = name + "_top." + extension; 134 std::string bottom = name + "_bottom." + extension; 135 std::string left = name + "_left." + extension; 136 std::string right = name + "_right." + extension; 137 std::string front = name + "_front." + extension; 138 std::string back = name + "_back." + extension; 139 139 140 140 this->setTextures(top, bottom, left, right, front, back); 141 142 // deleted alocated memory of this function143 delete []top;144 delete []bottom;145 delete []left;146 delete []right;147 delete []front;148 delete []back;149 141 } 150 142 … … 158 150 * @param back the back texture. 159 151 */ 160 void SkyBox::setTextures(const char* top, const char* bottom, const char*left,161 const char* right, const char* front, const char*back)152 void SkyBox::setTextures(const std::string& top, const std::string& bottom, const std::string& left, 153 const std::string& right, const std::string& front, const std::string& back) 162 154 { 163 155 this->material[0]->setDiffuseMap(top); … … 171 163 } 172 164 173 void SkyBox::loadCubeMapTextures(const char* top, const char* bottom, const char*left,174 const char* right, const char* front, const char*back)165 void SkyBox::loadCubeMapTextures(const std::string& top, const std::string& bottom, const std::string& left, 166 const std::string& right, const std::string& front, const std::string& back) 175 167 { 176 168 this->cubeTexture[0] = (Texture*)ResourceManager::getInstance()->load(top, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT); … … 304 296 305 297 SYNCHELP_READ_FLOAT( size, NWT_SB_SIZE ); 306 if ( textureName)298 if ( !this->textureName.empty() ) 307 299 { 308 delete[] textureName; 309 textureName = NULL; 300 textureName = ""; 310 301 } 311 SYNCHELP_READ_STRINGM( textureName, NWT_SB_TEXTURENAME ); 302 char* texName; 303 SYNCHELP_READ_STRINGM( texName, NWT_SB_TEXTURENAME ); 312 304 313 305 this->setSize( size ); 314 this->setTextureAndType( tex tureName, "jpg" );306 this->setTextureAndType( texName, "jpg" ); 315 307 this->rebuild(); 316 308 … … 338 330 339 331 SYNCHELP_WRITE_FLOAT(this->size, NWT_SB_SIZE); 340 SYNCHELP_WRITE_STRING(this->textureName , NWT_SB_TEXTURENAME);332 SYNCHELP_WRITE_STRING(this->textureName.c_str(), NWT_SB_TEXTURENAME); 341 333 342 334 return SYNCHELP_WRITE_N; -
branches/std/src/world_entities/skybox.h
r6771 r7208 28 28 { 29 29 public: 30 SkyBox(const char* fileName = NULL);30 SkyBox(const std::string& fileName = ""); 31 31 SkyBox(const TiXmlElement* root); 32 32 … … 44 44 void setSize(float size); 45 45 /** assumes jpg as input-format */ 46 void setTexture(const char* name) { if (textureName) delete[] textureName; textureName = new char[strlen(name)+1]; strcpy(textureName, name); this->setTextureAndType (name, "jpg"); };46 void setTexture(const std::string& name); 47 47 48 void setTextureAndType(const char* name, const char*extension);49 void setTextures(const char* top, const char* bottom, const char*left,50 const char* right, const char* front, const char*back);48 void setTextureAndType(const std::string& name, const std::string& extension); 49 void setTextures(const std::string& top, const std::string& bottom, const std::string& left, 50 const std::string& right, const std::string& front, const std::string& back); 51 51 52 void loadCubeMapTextures(const char* top, const char* bottom, const char*left,53 const char* right, const char* front, const char*back);52 void loadCubeMapTextures(const std::string& top, const std::string& bottom, const std::string& left, 53 const std::string& right, const std::string& front, const std::string& back); 54 54 55 55 GLuint getTexture(SKY_SIDE side) const { return (this->material[side]) ? this->material[side]->getDiffuseTexture(): 0; }; … … 71 71 float size; //!< Size of the SkyBox. This should match the frustum maximum range. 72 72 float textureSize; //!< this is the length of a texture (assumes a square texture) 73 char*textureName; //!< Name of the Texture73 std::string textureName; //!< Name of the Texture 74 74 75 75 };
Note: See TracChangeset
for help on using the changeset viewer.