Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/std/src/story_entities/story_entity.h @ 7214

Last change on this file since 7214 was 7214, checked in by bensch, 18 years ago

orxonox/trunk: now the branche works again, as it did before

File size: 4.1 KB
RevLine 
[4597]1/*!
[5039]2 * @file story_entity.h
[6424]3 *  holds the base class of everything that is playable - that is part of the story
4 */
[2636]5
[3221]6
[3224]7#ifndef _STORY_ENTITY_H
8#define _STORY_ENTITY_H
[2636]9
[3608]10#include "base_object.h"
[2636]11#include "story_def.h"
[3608]12#include "error.h"
[2636]13
[6424]14
15typedef enum StoryEntityState
16{
17  SE_STATE_RUN     = 0,
18  SE_STATE_STOP,
19  SE_STATE_PAUSE,
20
21  SE_STATE_NUM
22};
23
24
[3221]25//! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
[6634]26class StoryEntity : virtual public BaseObject {
[2636]27
28 public:
29  StoryEntity ();
[3221]30  virtual ~StoryEntity ();
[2636]31
[6512]32  virtual void loadParams(const TiXmlElement* root);
[6424]33
34  /* initialisation and loading */
35  /** initializes a Story Entity to the needed values */
[6153]36  virtual ErrorMessage init() {};
[6424]37  /** called to load the data into the StoryEntity*/
38  virtual ErrorMessage loadData() {};
39  /** function that unloads the data from the StoryEntity */
40  virtual ErrorMessage unloadData() {};
[2636]41
[6424]42  /* running, stopping and pausing */
43  /** starts the Entity. Starts the main cycle */
44  virtual bool start() = 0;
45  /**  Stops the entity. */
46  virtual bool stop() = 0;
47  /** pauses the Entity, you can resume the game by calling the resume() function */
48  virtual bool pause() = 0;
49  /** resumes a paused StoryEntity */
50  virtual bool resume() = 0;
51  /** function that is been called when the StoryEntity is started via start() */
52  virtual void run() = 0;
[6153]53
[6424]54  /* properties interface */
55  /** returns the state of this StoryEntity */
56  StoryEntityState getState();
[2636]57
[6424]58  /** sets the story id of the current entity, this enables it to be identified in a global context.  @param storyID the story id */
59  inline void setStoryID(int storyID) { this->storyID = storyID; }
60  /** sets the story id of the current entity, this enables it to be identified in a  global context. @returns  the story id  */
61  inline int getStoryID() { return this->storyID; }
[6992]62
[7203]63  void setLoadFile(const std::string& fileName);
[6992]64  /** @returns the Filename this StoryEntity was loaded with */
[7203]65  const std::string& getLoadFile() const { return this->loadFile; }
[6992]66
67  void setNextStoryID(int nextStoryID);
[6424]68  /**  gets the story id of the current entity @returns story id */
[6992]69  inline int getNextStoryID() const { return this->nextStoryID; }
[7214]70  inline void setDescription(const std::string& description);
[6837]71  /** @returns the description of this StoryEntity */
[7214]72  inline const std::string& getDescription() { return this->description; }
[6992]73
[6993]74  void grabWorldInfo();
[6839]75  /** toggle the menu visibility: SimpleMenu specific */
[6993]76  inline void addToGameMenu(bool toggle) { this->bMenuEntry = toggle; }
[6839]77  /** @returns true if the GameWorld should be contained in the SimpleMenu: SimpleMenu specific */
78  inline bool isContainedInMenu() { return this->bMenuEntry; }
[6841]79  /** sets the menu item image of this StoryEntity @param name name */
[7214]80  inline void setMenuItemImage(const std::string& image);
[6841]81  /** @returns the menu item image of this StoryEntity */
[7214]82  inline const std::string& getMenuItemImage() { return this->menuItemImage; }
83  inline void setMenuScreenshoot(const std::string& image);
[6841]84  /** @returns the menu screenshoot of this StoryEntity */
[7214]85  inline const std::string& getMenuScreenshoot() { return this->menuScreenshoot; }
[2636]86
[6152]87  protected:
[7203]88    bool          isInit;            //!< if the entity is initialized, this has to be true.
89    bool          isRunning;         //!< is true if the entity is running
90    bool          isPaused;          //!< is true if the entity is paused
[2636]91
[6424]92
[2636]93 private:
[7203]94    int           storyID;          //!< this is the number of this entity, identifying it in a list/tree...
95    int           nextStoryID;      //!< if this entity has finished, this entity shall be called
96    std::string   loadFile;         //!< The file from which this world is loaded
[6992]97
[7214]98    std::string   description;      //!< the description of the StoryEntity
99    std::string   menuItemImage;    //!< the item image of the StoryEntity
100    std::string   menuScreenshoot;  //!< the screenshoot of the StoryEntity
[7203]101    bool          bMenuEntry;       //!< If true, this GameWorld apears in the SimpleMenu: SimpleMenu specific
[2636]102};
103
[3224]104#endif /* _STORY_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.