Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 9, 2005, 11:01:50 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: minor

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

Legend:

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

    r4094 r4135  
    3131{
    3232  this->setClassName ("GraphicsEngine");
     33
     34  this->fullscreen = false;
     35
    3336  this->initVideo();
    3437
     
    140143int GraphicsEngine::setResolution(int width, int height, int bpp)
    141144{
     145  Uint32 fullscreenFlag;
    142146  this->resolutionX = width;
    143147  this->resolutionY = height;
    144148  this->bitsPerPixel = bpp;
     149  if (this->fullscreen)
     150    fullscreenFlag = SDL_FULLSCREEN;
     151  else
     152    fullscreenFlag = 0;
    145153 
    146154  printf ("ok\n");
    147   if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags)) == NULL)
     155  if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags | fullscreenFlag)) == NULL)
    148156    {
    149157      PRINTF(1)("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags, SDL_GetError());
     
    151159      //    return -1;
    152160    }
    153 
     161}
     162
     163void GraphicsEngine::setFullscreen(bool fullscreen)
     164{
     165  this->fullscreen = fullscreen;
     166  this->setResolution(this->resolutionX, this->resolutionY, this->bitsPerPixel);
    154167}
    155168
     
    257270  /* Check if our resolution is restricted */
    258271  if(this->videoModes == (SDL_Rect **)-1){
    259     PRINTF(1)("All resolutions available.\n");
     272    PRINTF(2)("All resolutions available.\n");
    260273  }
    261274  else{
     
    263276    PRINT(0)("Available Resoulution Modes are\n");
    264277    for(int i = 0; this->videoModes[i]; ++i)
    265       PRINT(0)(" |  %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h);
     278      PRINT(4)(" |  %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h);
    266279  }
    267280 
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r3844 r4135  
    2626  int setGLattribs(void);
    2727  int setResolution(int width, int height, int bpp);
     28  void setFullscreen(bool fullscreen = false);
    2829  /** \returns the x resolution */
    2930  inline int getResolutionX(void) {return this->resolutionX;}
Note: See TracChangeset for help on using the changeset viewer.