Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/graphics_engine.h @ 6690

Last change on this file since 6690 was 6522, checked in by bensch, 19 years ago

trunk: switch to WireFrame with
Shell → GraphicsEngine wireframe

File size: 4.8 KB
RevLine 
[4619]1/*!
[5039]2 * @file graphics_engine.h
[4619]3
[4836]4  *  defines a Interface between orxonox and graphical input
[3329]5
[3610]6    handles graphical SDL-initialisation, textures, resolutions, and so on
[4817]7 */
[1853]8
[3610]9#ifndef _GRAPHICS_ENGINE_H
10#define _GRAPHICS_ENGINE_H
[1853]11
[4817]12#include "event_listener.h"
[1853]13
[4381]14#include "sdlincl.h"
15#include "glincl.h"
[3543]16
[6142]17#include <list>
18
[4381]19// Forward Declaration
[4245]20class Text;
[4770]21class IniParser;
[5260]22class SubString;
[6142]23class WorldEntity;
[3543]24
[4458]25//! class to handle graphics
26/**
27   handles graphical SDL-initialisation, textures, resolutions, and so on
[4619]28 */
[4817]29class GraphicsEngine : public EventListener
[3610]30{
[4619]31  public:
32    virtual ~GraphicsEngine();
[4836]33    /** @returns a Pointer to the only object of this Class */
[5216]34    inline static GraphicsEngine* getInstance() { if (!GraphicsEngine::singletonRef) GraphicsEngine::singletonRef = new GraphicsEngine();  return GraphicsEngine::singletonRef; };
[1853]35
[4784]36    int init();
37    int initFromIniFile(IniParser* iniParser);
[4374]38
[4619]39    void setWindowName(const char* windowName, const char* icon);
[4831]40
[4619]41    int setResolution(int width, int height, int bpp);
42    void setFullscreen(bool fullscreen = false);
43    static void setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha = 1.0);
[3611]44
[4831]45
[4836]46    /** @returns the x resolution */
[4746]47    inline int getResolutionX() const { return this->resolutionX; };
[4836]48    /** @returns the y resolution */
[4746]49    inline int getResolutionY() const { return this->resolutionY; };
[4836]50    /** @returns the Bits Per Pixel */
[4746]51    inline int getbbp() const { return this->bitsPerPixel; };
[3611]52
[4782]53    int resolutionChanged(const SDL_ResizeEvent& resizeInfo);
[3790]54
[4833]55    static void showMouse(bool show);
56    static bool isMouseVisible();
57    static void stealWMEvents(bool steal);
58    static bool isStealingEvents();
[4831]59
[4746]60    static void enter2DMode();
61    static void leave2DMode();
[3844]62
[6522]63    void wireframe();
64
[4746]65    static void storeMatrices();
[4619]66    static GLdouble modMat[16];
67    static GLdouble projMat[16];
68    static GLint viewPort[4];
[3844]69
[5084]70    void update(float dt);
[4619]71    void tick(float dt);
[4849]72    void draw() const;
[6142]73    void draw(const std::list<WorldEntity*>& drawList) const;
[4619]74    void displayFPS(bool display);
[3245]75
[4746]76    void listModes();
[5261]77    bool hwSupportsEXT(const char* extension);
[3617]78
[5366]79    /** @brief swaps the GL_BUFFERS */
[4834]80    inline static void swapBuffers() { SDL_GL_SwapBuffers(); };
[4681]81
[4817]82    void process(const Event  &event);
[4619]83
84  private:
85    GraphicsEngine();
[4784]86    int initVideo(unsigned int resX, unsigned int resY, unsigned int bbp);
[4831]87    int setGLattribs();
[5260]88    void grabHardwareSettings();
[4619]89
[4784]90  public:
91
[4619]92  private:
[5346]93    static GraphicsEngine*  singletonRef;       //!< Pointer to the only instance of this Class
94    bool                    isInit;             //!< if the GraphicsEngine is initialized.
[4619]95
[5346]96    // state.
97    SDL_Surface*            screen;             //!< the screen we draw to
98    int                     resolutionX;        //!< the X-resoultion of the screen
99    int                     resolutionY;        //!< the Y-resolution of the screen
100    int                     bitsPerPixel;       //!< the bits per pixels of the screen
101    Uint32                  fullscreenFlag;     //!< if we are in fullscreen mode
102    Uint32                  videoFlags;         //!< flags for video
103    SDL_Rect**              videoModes;         //!< list of resolutions
[4619]104
[5346]105    bool                    fogEnabled;         //!< If Fog should be enabled.
106    bool                    shadowsEnabled;     //!< If Shadows should be enabled.
107    bool                    particlesEnabled;   //!< If particles should be enabled.
108    int                     particlesValue;     //!< How many particles
109    int                     textureQuality;     //!< the quality of Textures
110    int                     filteringMethod;    //!< The filtering Method of textures.
111    int                     modelQuality;       //!< The quality of the Models loaded.
112    int                     antialiasingDepth;  //!< the Depth of the AntiAlias-Filter.
[4619]113
[5260]114    // HARDWARE-Settings:
[5346]115    char*                   hwRenderer;         //!< HW-renderer-string
116    char*                   hwVendor;           //!< HW-vendor-string
117    char*                   hwVersion;          //!< HW-version-string
118    SubString*              hwExtensions;       //!< All suported Extensions.
[4619]119
[5346]120    // FPS-related
121    bool                    bDisplayFPS;        //!< is true if the fps should be displayed
122    float                   currentFPS;         //!< the current frame rate: frames per seconds
123    float                   maxFPS;             //!< maximal frame rate we ever got since start of the game
124    float                   minFPS;             //!< minimal frame rate we ever got since start.
125
[4536]126#ifndef NO_TEXT
[5346]127  Text*          geTextCFPS;                    //!< Text for the current FPS
128  Text*          geTextMaxFPS;                  //!< Text for the max FPS
129  Text*          geTextMinFPS;                  //!< Text for the min FPS
[4536]130#endif /* NO_TEXT */
[1853]131};
132
[3610]133#endif /* _GRAPHICS_ENGINE_H */
Note: See TracBrowser for help on using the repository browser.