Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/util/loading/game_loader.h @ 10713

Last change on this file since 10713 was 10618, checked in by bknecht, 18 years ago

merged cleanup into trunk (only improvements)

File size: 2.3 KB
RevLine 
[4598]1/*!
[4885]2 * @file game_loader.h
3 *  loads campaigns, worlds and all other story_entities
[4598]4*/
[3629]5
[3224]6#ifndef _GAME_LOADER_H
7#define _GAME_LOADER_H
[2636]8
[3608]9//#include "stdincl.h"
[2636]10#include "story_def.h"
[4410]11#include "event_listener.h"
[2636]12
[5819]13#include "error.h"
[4010]14
[2636]15//-----------------------------------------------------------------------------
16// Forward declarations
17//-----------------------------------------------------------------------------
18class Campaign;
19class World;
[4261]20class Factory;
21class TiXmlElement;
22class BaseObject;
[4410]23class Event;
[2636]24
[3629]25//! The GameLoader
26/**
[6152]27 *  The game loader loads all game date. this is performed in the following way:
28 * 1. Read the structure of campaings and worlds
29 * 2. Create the instances of the tree: here _ALL_ StoryEntities are created
30 *    also if they are not yet used. the worlds should load their data in
31 *    the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE!
32 *    Elsewhere, all the data will be allocated at the beginning... mess...
33 * 3. StoryEntities are load() and init() before they start
34 * 4. once the gamloader starts the game there will be a campaing starting a
35 *    world. this is done by callaing those StoryEntity::start()
[3629]36*/
[4410]37class GameLoader : public EventListener
[2636]38{
[9869]39  ObjectListDeclaration(GameLoader);
40  public:
[6981]41  virtual ~GameLoader ();
[6424]42  /**  this class is a singleton class @returns an instance of itself  */
43  static GameLoader* getInstance() { if(singletonRef == NULL) singletonRef = new GameLoader(); return singletonRef; }
[4487]44
[7221]45  ErrorMessage loadCampaign(const std::string& name);
[6424]46  ErrorMessage loadDebugCampaign(Uint32 campaignID);
[7221]47  ErrorMessage loadNetworkCampaign(const std::string& fileName);
[2636]48
[3222]49  ErrorMessage init();
50  ErrorMessage start();
[5139]51  void stop();
[3222]52  ErrorMessage pause();
53  ErrorMessage resume();
[2636]54
[6424]55  void switchToNextLevel();
[6139]56
[4410]57  void process(const Event &event);
58
[6139]59
[2636]60 private:
61  GameLoader ();
62
[7221]63  Campaign* fileToCampaign(const std::string& name);
[2636]64
[6139]65
[4487]66 private:
67  static GameLoader*     singletonRef;         //!< The singleton-reference to this object
68
69  Uint32                 startTime;            //!< start time of the campaign
70  bool                   isPaused;             //!< if the game is paused
[6862]71  bool                   bRun;                 //!< true if stop
[4487]72
[4511]73  Campaign*              currentCampaign;      //!< reference to the current campaign playing
[2636]74};
75
[3224]76#endif /* _GAME_LOADER_H */
Note: See TracBrowser for help on using the repository browser.