Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5600 was 5139, checked in by bensch, 19 years ago

orxonox/trunk: registered 'quit' from GameLoader

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
[4010]14
[2636]15//-----------------------------------------------------------------------------
16// Forward declarations
17//-----------------------------------------------------------------------------
18class Campaign;
19class World;
[4261]20class Factory;
21class TiXmlElement;
22class BaseObject;
[4410]23class Event;
[4411]24class EventHandler;
[2636]25
[3629]26//! The GameLoader
27/**
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()
37*/
[4410]38class GameLoader : public EventListener
[2636]39{
40
41 public:
[4487]42  ~GameLoader ();
43
[2636]44  static GameLoader* getInstance();
45
[3222]46  ErrorMessage init();
[4216]47  ErrorMessage loadCampaign(const char* name);
[3222]48  ErrorMessage start();
[5139]49  void stop();
[3222]50  ErrorMessage pause();
51  ErrorMessage resume();
[3225]52  ErrorMessage destroy();
[2636]53
54  void nextLevel();
55  void previousLevel();
56
[4836]57  /** \brief a world command to send to the GameLoader @param cmd the command */
[2636]58  bool worldCommand(Command* cmd);
[3222]59  ErrorMessage loadDebugCampaign(Uint32 campaignID);
[4598]60
[4487]61  void registerFactory( Factory* factory );
[4598]62  BaseObject* fabricate(const TiXmlElement* data);
[4010]63
[4410]64  void process(const Event &event);
65
[2636]66 private:
67  GameLoader ();
68
[4113]69  Campaign* fileToCampaign(const char* name);
[2636]70
[4487]71 private:
72  static GameLoader*     singletonRef;         //!< The singleton-reference to this object
73
74  Uint32                 startTime;            //!< start time of the campaign
75  bool                   isPaused;             //!< if the game is paused
76
[4511]77  Campaign*              currentCampaign;      //!< reference to the current campaign playing
[4598]78
[4487]79  EventHandler*          eventHandler;         //!< reference to the eventHandler
[2636]80};
81
[3224]82#endif /* _GAME_LOADER_H */
Note: See TracBrowser for help on using the repository browser.