Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/util/loading/game_loader.h @ 9836

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

renamed newclassid to classid and newobjectlist to objectlist

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