Changeset 6853 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- Jan 30, 2006, 3:40:05 AM (19 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/simple_game_menu.cc
r6852 r6853 194 194 PRINTF(0)("Got a new menu entry |%s|\n", se->getName()); 195 195 ImageEntity* ie = new ImageEntity(); 196 PRINTF(0)("setting texture to: |%s|\n", se->getMenuItemImage()); 196 197 ie->setTexture(se->getMenuItemImage()); 197 198 ie->setRelCoor(0.0f,- (this->menuLayer[1]->menuList.size() * 10.0f), 0.0f); … … 288 289 289 290 this->switchMenuLayer(this->layerIndex, 1); 290 291 }292 }293 else if( event.type == SDLK_DOWN && event.bPressed == true)294 {295 // ImageEntity*296 if(this->menuSelectedIndex < (this->menuLayer[this->layerIndex]->menuList.size() - 1))297 {298 this->menuSelected = this->menuLayer[this->layerIndex]->menuList[++this->menuSelectedIndex];299 this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());300 }301 }302 else if( event.type == SDLK_UP && event.bPressed == true)303 {304 if(this->menuSelectedIndex > 0)305 {306 this->menuSelected = this->menuLayer[this->layerIndex]->menuList[--this->menuSelectedIndex];307 this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor());308 291 } 309 292 } … … 315 298 this->setNextStoryID( this->menuLayer[1]->storyList[this->menuSelectedIndex]->getStoryID()); 316 299 this->stop(); 300 } 301 } 302 303 304 305 // The menu selction cursor 306 if( event.type == SDLK_DOWN && event.bPressed == true) 307 { 308 if(this->menuSelectedIndex < (this->menuLayer[this->layerIndex]->menuList.size() - 1)) 309 { 310 this->menuSelected = this->menuLayer[this->layerIndex]->menuList[++this->menuSelectedIndex]; 311 this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor()); 312 } 313 } 314 else if( event.type == SDLK_UP && event.bPressed == true) 315 { 316 if(this->menuSelectedIndex > 0) 317 { 318 this->menuSelected = this->menuLayer[this->layerIndex]->menuList[--this->menuSelectedIndex]; 319 this->menuSelector->setAbsCoor(this->menuSelected->getAbsCoor()); 317 320 } 318 321 } -
trunk/src/story_entities/story_entity.cc
r6848 r6853 41 41 this->storyID = -1; 42 42 this->description = NULL; 43 this->menuItemImage = "pictures/menu/DefaultMenuItem.png";43 this->menuItemImage = NULL; 44 44 this->nextStoryID = WORLD_ID_GAMEEND; 45 45 this->bMenuEntry = false; … … 82 82 PRINTF(4)("Loaded StoryEntity specific stuff\n"); 83 83 } 84 85 86 /** 87 * sets the descroption of this StoryEntity 88 * @param name name 89 */ 90 void StoryEntity::setDescription(const char* description) 91 { 92 if (this->description) 93 delete[] this->description; 94 if (description!= NULL) 95 { 96 this->description= new char[strlen(description)+1]; 97 strcpy(this->description, description); 98 } 99 else this->description= NULL; 100 } 101 102 103 /** 104 * sets the menu item image of this StoryEntity 105 * @param name name 106 */ 107 void StoryEntity::setMenuItemImage(const char* image) 108 { 109 if (this->menuItemImage) 110 delete[] this->menuItemImage; 111 if (image != NULL) 112 { 113 this->menuItemImage = new char[strlen(image)+1]; 114 strcpy(this->menuItemImage, image); 115 } 116 else this->menuItemImage = NULL; 117 } 118 119 120 /** sets the menu screenshoot of this StoryEntity @param name name */ 121 void StoryEntity::setMenuScreenshoot(const char* image) 122 { 123 if (this->menuScreenshoot) 124 delete[] this->menuScreenshoot; 125 if (image != NULL) 126 { 127 this->menuScreenshoot = new char[strlen(image)+1]; 128 strcpy(this->menuScreenshoot, image); 129 } 130 else this->menuScreenshoot = NULL; 131 } 132 133 -
trunk/src/story_entities/story_entity.h
r6841 r6853 67 67 /** gets the story id of the current entity @returns story id */ 68 68 inline int getNextStoryID() { return this->nextStoryID; } 69 /** sets the descroption of this StoryEntity @param name name */ 70 inline void setDescription(const char* description) { this->description = description; } 69 inline void setDescription(const char* description); 71 70 /** @returns the description of this StoryEntity */ 72 71 inline const char* getDescription() { return this->description; } … … 76 75 inline bool isContainedInMenu() { return this->bMenuEntry; } 77 76 /** sets the menu item image of this StoryEntity @param name name */ 78 inline void setMenuItemImage(const char* image) { this->menuItemImage = image; }77 inline void setMenuItemImage(const char* image); 79 78 /** @returns the menu item image of this StoryEntity */ 80 79 inline const char* getMenuItemImage() { return this->menuItemImage; } 81 /** sets the menu screenshoot of this StoryEntity @param name name */ 82 inline void setMenuScreenshoot(const char* image) { this->menuScreenshoot = image; } 80 inline void setMenuScreenshoot(const char* image); 83 81 /** @returns the menu screenshoot of this StoryEntity */ 84 82 inline const char* getMenuScreenshoot() { return this->menuScreenshoot; } … … 94 92 int storyID; //!< this is the number of this entity, identifying it in a list/tree... 95 93 int nextStoryID; //!< if this entity has finished, this entity shall be called 96 c onst char* description;//!< the description of the StoryEntity97 c onst char* menuItemImage;//!< the item image of the StoryEntity98 c onst char* menuScreenshoot;//!< the screenshoot of the StoryEntity94 char* description; //!< the description of the StoryEntity 95 char* menuItemImage; //!< the item image of the StoryEntity 96 char* menuScreenshoot; //!< the screenshoot of the StoryEntity 99 97 bool bMenuEntry; //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific 100 98 };
Note: See TracChangeset
for help on using the changeset viewer.