Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/story_entities/game_world.h @ 7994

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

orxonox/trunk: merged the gui branche back
merged with command:
https://svn.orxonox.net/orxonox/branches/gui
no conflicts

File size: 3.5 KB
RevLine 
[6352]1/*!
2 * @file game_world.h
3 *  container for all game worlds (singleplayers, multiplayers..)
4 */
5
6#ifndef _GAME_WORLD_H
7#define _GAME_WORLD_H
8
[6402]9
[6352]10#include "story_entity.h"
[6498]11#include "game_world_data.h"
[7338]12#include "playable.h"
[6352]13
[7762]14namespace OrxShell { class Shell; };
[6402]15class WorldEntity;
[7391]16class GameRules;
[6352]17
[7131]18/** How many frames time values to keep
19 * The higher the value the smoother the result is...
20 * Don't make it 0 or less :)
21 */
22#define TICK_SMOOTH_VALUE 10
[6402]23
[6352]24//! The game world
25/**
26 *  this class initializes everything that should be displayed inside of the current level.
27 *  it is the main driving factor during gameplay.
28 */
29class GameWorld : public StoryEntity
30{
31  public:
[6989]32    GameWorld ();
[6352]33    virtual ~GameWorld ();
34
[6512]35    virtual void loadParams(const TiXmlElement* root);
[6352]36
[6370]37    /* functions from story-entity */
38    virtual ErrorMessage init();
[6372]39    virtual ErrorMessage loadData();
[6387]40    virtual ErrorMessage unloadData();
[6352]41
[6387]42    virtual bool start();
43    virtual bool stop();
44    virtual bool pause();
45    virtual bool resume();
46    virtual void run();
[6352]47
[7338]48    void setPlaymode(Playable::Playmode playmode);
[7339]49    void setPlaymode(const std::string& playmode);
[6366]50    /**  this returns the current game time @returns elapsed game time     */
51    inline double getGameTime() { return this->gameTime; }
52    /** sets the game speed @param speed speed of the Game */
[6352]53    inline void setSpeed(float speed) { this->speed = speed; };
[6366]54    /**  returns the track path of this world @returns the track path */
[6352]55
[7723]56    void togglePNodeVisibility();
[7739]57    void toggleBVVisibility(int level);
[6352]58
[6498]59    inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; }
60
61
[6352]62  protected:
63    /* world - running functions */
[6386]64    virtual void synchronize();
65    virtual void handleInput();
[7370]66    virtual void tick(ObjectManager::EntityList worldEntity, float dt);
[6386]67    virtual void tick();
68    virtual void update();
[7391]69    virtual void checkGameRules();
[6386]70    virtual void collide();
[7370]71
72    void drawEntityList(const ObjectManager::EntityList& drawList ) const;
[7785]73    virtual void renderPassReflection();
74    virtual void renderPassRefraction();
75    virtual void renderPassAll();
76
77
[6386]78    virtual void display();
[6352]79
80
[6386]81  private:
82    void displayLoadScreen();
83    void releaseLoadScreen();
84
85
[6352]86  protected:
[6407]87    GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
[6845]88    TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
[6352]89
[6387]90    bool                showPNodes;                   //!< if the PNodes should be visible.
91    bool                showBV;                       //!< if the Bounding Volumes should be visible.
[7739]92    int                 showBVLevel;                  //!< the depth level of the displayed bounding volumes
[6352]93
94    /* world timing */
[7919]95    double              lastFrame;                    //!< last time of frame (in MiliSeconds)
[6402]96    Uint32              cycle;                        //!< The cycle we are in (starts with 0 and rises with every frame)
97    float               dtS;                          //!< The time needed for caluculations in seconds
98    float               speed;                        //!< how fast the game flows
99    double              gameTime;                     //!< this is where the game time is saved
[7919]100    double              frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames.
[6352]101
[7391]102    GameRules*          gameRules;                    //!< Pointer to the data structure containig the game rules
[7131]103
[7391]104
[7374]105  private:
[6352]106    /* external modules interfaces */
[7374]107    OrxShell::Shell*    shell;
[6387]108};
[6352]109
110#endif /* _GAME_WORLD_H */
Note: See TracBrowser for help on using the repository browser.