Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 4465 was 4411, checked in by patrick, 20 years ago

orxonox/trunk: now system events work again: quit, pause, next-level

File size: 2.1 KB
Line 
1/*!
2    \file game_loader.h
3    \brief loads campaigns, worlds and all other story_entities
4*/ 
5
6#ifndef _GAME_LOADER_H
7#define _GAME_LOADER_H
8
9//#include "stdincl.h"
10#include "story_def.h"
11#include "comincl.h"
12#include "event_listener.h"
13
14
15//-----------------------------------------------------------------------------
16// Forward declarations
17//-----------------------------------------------------------------------------
18class Campaign;
19class World;
20class Camera;
21class CammandNode;
22class Factory;
23class TiXmlElement;
24class BaseObject;
25class Event;
26class EventHandler;
27
28//! The GameLoader
29/**
30   The game loader loads all game date. this is performed in the following way:
31   1. Read the structure of campaings and worlds
32   2. Create the instances of the tree: here _ALL_ StoryEntities are created
33      also if they are not yet used. the worlds should load their data in
34      the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE!
35      Elsewhere, all the data will be allocated at the beginning... mess...
36   3. StoryEntities are load() and init() before they start
37   4. once the gamloader starts the game there will be a campaing starting a
38      world. this is done by callaing those StoryEntity::start()
39*/
40class GameLoader : public EventListener
41{
42
43 public:
44  static GameLoader* getInstance();
45
46  ErrorMessage init();
47  ErrorMessage loadCampaign(const char* name);
48  ErrorMessage start();
49  ErrorMessage stop();
50  ErrorMessage pause();
51  ErrorMessage resume();
52  ErrorMessage destroy();
53
54  void nextLevel();
55  void previousLevel();
56
57  bool worldCommand(Command* cmd);
58  ErrorMessage loadDebugCampaign(Uint32 campaignID);
59 
60  void registerFactory( Factory* factory);
61  BaseObject* fabricate( TiXmlElement* data);
62
63  void process(const Event &event);
64
65 private:
66  GameLoader ();
67  ~GameLoader ();
68  Uint32 startTime; //!> start time of the campaign
69  static GameLoader* singletonRef;
70  bool isPaused;
71
72  Campaign* currentCampaign; //!> the current campaign playing
73 
74  Campaign* fileToCampaign(const char* name);
75  EventHandler* eventHandler;
76
77  Factory* first;
78};
79
80#endif /* _GAME_LOADER_H */
Note: See TracBrowser for help on using the repository browser.