Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 10, 2005, 10:39:01 AM (20 years ago)
Author:
patrick
Message:

orxonox/branches/md2_loader: merged trunk into branche using: svn merge ../trunk/ md2_loader -r 4063:HEAD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/md2_loader/src/lib/graphics/graphics_engine.cc

    r4126 r4139  
    1717
    1818#include "graphics_engine.h"
     19#include "resource_manager.h"
    1920
    2021#include "debug.h"
     
    3435  this->maxFPS = 0;
    3536  this->setClassName ("GraphicsEngine");
     37
     38  this->fullscreen = false;
     39
    3640  this->initVideo();
    3741
     
    105109 
    106110  // TO DO: Create a cool icon and use it here
    107   SDL_WM_SetIcon(SDL_LoadBMP("../data/pictures/orxonox-icon32x32.bmp"), NULL); 
    108 
     111  char* loadPic = new char[strlen(ResourceManager::getInstance()->getDataDir())+ 100];
     112  sprintf(loadPic, "%s%s", ResourceManager::getInstance()->getDataDir(),  "pictures/orxonox-icon32x32.bmp");
     113  SDL_WM_SetIcon(SDL_LoadBMP(loadPic), NULL); 
     114  delete loadPic;
    109115  // Enable default GL stuff
    110116  glEnable(GL_DEPTH_TEST);
     
    141147int GraphicsEngine::setResolution(int width, int height, int bpp)
    142148{
     149  Uint32 fullscreenFlag;
    143150  this->resolutionX = width;
    144151  this->resolutionY = height;
    145152  this->bitsPerPixel = bpp;
     153  if (this->fullscreen)
     154    fullscreenFlag = SDL_FULLSCREEN;
     155  else
     156    fullscreenFlag = 0;
    146157 
    147158  printf ("ok\n");
    148   if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags)) == NULL)
     159  if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags | fullscreenFlag)) == NULL)
    149160    {
    150161      PRINTF(1)("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags, SDL_GetError());
     
    152163      //    return -1;
    153164    }
    154 
     165}
     166
     167void GraphicsEngine::setFullscreen(bool fullscreen)
     168{
     169  this->fullscreen = fullscreen;
     170  this->setResolution(this->resolutionX, this->resolutionY, this->bitsPerPixel);
    155171}
    156172
     
    258274  /* Check if our resolution is restricted */
    259275  if(this->videoModes == (SDL_Rect **)-1){
    260     PRINTF(1)("All resolutions available.\n");
     276    PRINTF(2)("All resolutions available.\n");
    261277  }
    262278  else{
     
    264280    PRINT(0)("Available Resoulution Modes are\n");
    265281    for(int i = 0; this->videoModes[i]; ++i)
    266       PRINT(0)(" |  %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h);
     282      PRINT(4)(" |  %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h);
    267283  }
    268284}
Note: See TracChangeset for help on using the changeset viewer.