Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5346 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Oct 10, 2005, 1:17:11 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: code-renice

Location:
trunk/src/lib/graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/graphics_engine.cc

    r5344 r5346  
    115115  // looking if we are in fullscreen-mode
    116116  const char* fullscreen = iniParser->getVar(CONFIG_NAME_FULLSCREEN, CONFIG_SECTION_VIDEO, "0");
    117   if (strchr(fullscreen, '1'))
     117  if (strchr(fullscreen, '1') || strcasestr(fullscreen, "true"))
    118118    this->fullscreenFlag = SDL_FULLSCREEN;
    119 
    120 
    121119
    122120  // looking if we are in fullscreen-mode
    123121  const char* textures = iniParser->getVar(CONFIG_NAME_TEXTURES, CONFIG_SECTION_VIDEO_ADVANCED, "0");
    124   if (strchr(textures, '1'))
     122  if (strchr(textures, '1') || strcasestr(textures, "true"))
    125123    this->texturesEnabled = true;
    126124  else
     
    138136/**
    139137 *  initializes the Video for openGL.
    140 
    141    This has to be done only once when starting orxonox.
    142 */
     138 *
     139 * This has to be done only once when starting orxonox.
     140 */
    143141int GraphicsEngine::initVideo(unsigned int resX, unsigned int resY, unsigned int bbp)
    144142{
     
    209207/**
    210208 *  Sets the GL-attributes
    211 */
     209 */
    212210int GraphicsEngine::setGLattribs()
    213211{
     
    284282 * @param height The height of the window
    285283 * @param bpp bits per pixel
    286 */
     284 */
    287285int GraphicsEngine::setResolution(int width, int height, int bpp)
    288286{
     
    323321 * @param green the green part of the background
    324322 * @param alpha the alpha part of the background
    325 */
     323 */
    326324void GraphicsEngine::setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
    327325{
     
    332330 *  Signalhandler, for when the resolution has changed
    333331 * @param resizeInfo SDL information about the size of the new screen size
    334 */
     332 */
    335333int GraphicsEngine::resolutionChanged(const SDL_ResizeEvent& resizeInfo)
    336334{
     
    431429
    432430/**
    433  *  leaves the 2DMode again also \see Font::enter2DMode()
    434 */
     431 *  leaves the 2DMode again also @see Font::enter2DMode()
     432 */
    435433void GraphicsEngine::leave2DMode()
    436434{
     
    446444/**
    447445 *  stores the GL_matrices
    448 */
     446 */
    449447void GraphicsEngine::storeMatrices()
    450448{
     
    465463/**
    466464 *  outputs all the Fullscreen modes.
    467 */
     465 */
    468466void GraphicsEngine::listModes()
    469467{
     
    515513 *  ticks the Text
    516514 * @param dt the time passed
    517 */
    518   void GraphicsEngine::tick(float dt)
     515 */
     516void GraphicsEngine::tick(float dt)
    519517{
    520518  if( unlikely(this->bDisplayFPS))
     
    552550
    553551/**
    554  *  displays the Frames per second
     552 * displays the Frames per second
    555553 * @param display if the text should be displayed
    556 
    557    @todo this is dangerous
    558554*/
    559555void GraphicsEngine::displayFPS(bool display)
    560556{
    561   if( display)
    562     {
    563557#ifndef NO_TEXT
    564 if (this->geTextCFPS == NULL)
    565 {
    566   this->geTextCFPS = new Text("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);
    567   this->geTextCFPS->setName("curFPS");
    568   this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT);
    569   this->geTextCFPS->setAbsCoor2D(5, 15);
    570 }
    571 if (this->geTextMaxFPS == NULL)
    572 {
    573       this->geTextMaxFPS = new Text("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);
    574       this->geTextMaxFPS->setName("MaxFPS");
    575       this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT);
    576       this->geTextMaxFPS->setAbsCoor2D(5, 40);
    577 }
    578 if (this->geTextMinFPS == NULL)
    579 {
    580       this->geTextMinFPS = new Text("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);
    581       this->geTextMinFPS->setName("MinFPS");
    582       this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
    583       this->geTextMinFPS->setAbsCoor2D(5, 65);
    584 }
     558  if( display )
     559{
     560  if (this->geTextCFPS == NULL)
     561  {
     562    this->geTextCFPS = new Text("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);
     563    this->geTextCFPS->setName("curFPS");
     564    this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT);
     565    this->geTextCFPS->setAbsCoor2D(5, 15);
     566  }
     567  if (this->geTextMaxFPS == NULL)
     568  {
     569    this->geTextMaxFPS = new Text("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);
     570    this->geTextMaxFPS->setName("MaxFPS");
     571    this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT);
     572    this->geTextMaxFPS->setAbsCoor2D(5, 40);
     573  }
     574  if (this->geTextMinFPS == NULL)
     575  {
     576    this->geTextMinFPS = new Text("fonts/arial_black.ttf", 15, TEXT_RENDER_DYNAMIC);
     577    this->geTextMinFPS->setName("MinFPS");
     578    this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
     579    this->geTextMinFPS->setAbsCoor2D(5, 65);
     580  }
     581}
     582else
     583{
     584  delete this->geTextCFPS;
     585  this->geTextCFPS = NULL;
     586  delete this->geTextMaxFPS;
     587  this->geTextMaxFPS = NULL;
     588  delete this->geTextMinFPS;
     589  this->geTextMinFPS = NULL;
     590}
     591  this->bDisplayFPS = display;
     592#else
     593  this->bDisplayFPS = false;
    585594#endif /* NO_TEXT */
    586     }
    587   this->bDisplayFPS = display;
    588 }
    589 
    590 
    591 /**
    592   \brief processes the events for the GraphicsEngine class
     595}
     596
     597
     598/**
     599  processes the events for the GraphicsEngine class
    593600* @param the event to handle
    594601 */
     
    603610
    604611}
    605 
  • trunk/src/lib/graphics/graphics_engine.h

    r5261 r5346  
    8383
    8484  public:
    85     static bool             texturesEnabled; //!< if textures should be enabled (globally)
     85    static bool             texturesEnabled;    //!< if textures should be enabled (globally)
    8686
    8787
    8888  private:
    89     static GraphicsEngine*  singletonRef;    //!< Pointer to the only instance of this Class
    90     bool                    isInit;          //!< if the GraphicsEngine is initialized.
     89    static GraphicsEngine*  singletonRef;       //!< Pointer to the only instance of this Class
     90    bool                    isInit;             //!< if the GraphicsEngine is initialized.
    9191
    92     SDL_Surface*            screen;          //!< the screen we draw to
    93     int                     resolutionX;     //!< the X-resoultion of the screen
    94     int                     resolutionY;     //!< the Y-resolution of the screen
    95     int                     bitsPerPixel;    //!< the bits per pixels of the screen
    96     Uint32                  fullscreenFlag;  //!< if we are in fullscreen mode
    97     Uint32                  videoFlags;      //!< flags for video
    98     SDL_Rect**              videoModes;      //!< list of resolutions
     92    // state.
     93    SDL_Surface*            screen;             //!< the screen we draw to
     94    int                     resolutionX;        //!< the X-resoultion of the screen
     95    int                     resolutionY;        //!< the Y-resolution of the screen
     96    int                     bitsPerPixel;       //!< the bits per pixels of the screen
     97    Uint32                  fullscreenFlag;     //!< if we are in fullscreen mode
     98    Uint32                  videoFlags;         //!< flags for video
     99    SDL_Rect**              videoModes;         //!< list of resolutions
    99100
    100     bool                    bDisplayFPS;     //!< is true if the fps should be displayed
    101     float                   currentFPS;      //!< the current frame rate: frames per seconds
    102     float                   maxFPS;          //!< maximal frame rate we ever got since start of the game
    103     float                   minFPS;          //!< minimal frame rate we ever got since start
     101    bool                    fogEnabled;         //!< If Fog should be enabled.
     102    bool                    shadowsEnabled;     //!< If Shadows should be enabled.
     103    bool                    particlesEnabled;   //!< If particles should be enabled.
     104    int                     particlesValue;     //!< How many particles
     105    int                     textureQuality;     //!< the quality of Textures
     106    int                     filteringMethod;    //!< The filtering Method of textures.
     107    int                     modelQuality;       //!< The quality of the Models loaded.
     108    int                     antialiasingDepth;  //!< the Depth of the AntiAlias-Filter.
    104109
    105110    // HARDWARE-Settings:
    106     char*                   hwRenderer;
    107     char*                   hwVendor;
    108     char*                   hwVersion;
    109     SubString*              hwExtensions;
     111    char*                   hwRenderer;         //!< HW-renderer-string
     112    char*                   hwVendor;           //!< HW-vendor-string
     113    char*                   hwVersion;          //!< HW-version-string
     114    SubString*              hwExtensions;       //!< All suported Extensions.
     115
     116    // FPS-related
     117    bool                    bDisplayFPS;        //!< is true if the fps should be displayed
     118    float                   currentFPS;         //!< the current frame rate: frames per seconds
     119    float                   maxFPS;             //!< maximal frame rate we ever got since start of the game
     120    float                   minFPS;             //!< minimal frame rate we ever got since start.
    110121
    111122#ifndef NO_TEXT
    112   Text*          geTextCFPS;      //!< Text for the current FPS
    113   Text*          geTextMaxFPS;    //!< Text for the max FPS
    114   Text*          geTextMinFPS;    //!< Text for the min FPS
     123  Text*          geTextCFPS;                    //!< Text for the current FPS
     124  Text*          geTextMaxFPS;                  //!< Text for the max FPS
     125  Text*          geTextMinFPS;                  //!< Text for the min FPS
    115126#endif /* NO_TEXT */
    116127};
Note: See TracChangeset for help on using the changeset viewer.