Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4135 in orxonox.OLD for orxonox


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

orxonox/trunk: minor

Location:
orxonox/trunk/src
Files:
4 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;}
  • orxonox/trunk/src/orxonox.cc

    r4134 r4135  
    4848/**
    4949   \brief create a new Orxonox
     50
     51   In this funcitons only global values are set. The game will not be started here.
    5052*/
    5153Orxonox::Orxonox ()
     
    5658  this->resources = NULL;
    5759  this->localinput = NULL;
     60
     61  this->argc = 0;
     62  this->argv = NULL;
    5863}
    5964
     
    103108int Orxonox::init (int argc, char** argv)
    104109{
     110  this->argc = argc;
     111  this->argv = argv;
    105112  // parse command line
    106113  // config file
     
    132139 
    133140  GraphicsEngine::getInstance();
    134  
     141
     142  /*
     143 int i;
     144  for(i = 1; i < this->argc; ++i)
     145    {
     146      if (!strncmp (this->argv[i], "-r", 2))
     147        {
     148          char* tmp = strchr (argv[i], 'x');
     149          //      GraphicsEngine::getInstance()->setResolution(atoi(argv[i]), atoi(tmp+1), 24);
     150        }
     151      else if (!strncmp(this->argv[i], "--resolution=", 13))
     152        {
     153        }
     154    }
     155  */
    135156  return 0;
    136157}
     
    339360*/
    340361int main(int argc, char** argv)
    341 
    342  
    343   /* reading arguments
    344      
    345      currently supported arguments are:
    346      <no args>                   ::    just starts orxonox
    347      --benchmark                 ::    start the benchmark without starting orxonox
    348      
    349      this is a preselection: it matches to one of the start* functions, the
    350      finetuning is made in those functions.
    351   */
    352 
    353 
     362{
     363
     364  // here the pre-arguments are loaded, these are needed to go either to orxonx itself, Help, or Benchmark.
    354365  int i;
    355366  for(i = 1; i < argc; ++i)
    356367    {
    357       if(! strcmp( "--help", argv[i])) return startHelp(argc, argv);
    358       else if(! strcmp( "--benchmark", argv[i])) return startBenchmarks();
    359       else if(! strcmp( "--gui", argv[i]) || !strcmp("-g", argv[i])) showGui = true;
    360       else PRINTF(2)("Orxonox does not understand the arguments %s\n", argv[i]);
     368      if(! strcmp( "--help", argv[i]) || !strcmp("-h", argv[i])) return startHelp(argc, argv);
     369      else if(!strcmp( "--benchmark", argv[i]) || !strcmp("-b", argv[i])) return startBenchmarks();
     370      else if(!strcmp( "--gui", argv[i]) || !strcmp("-g", argv[i])) showGui = true;
     371      //      else PRINTF(2)("Orxonox does not understand the arguments %s\n", argv[i]);
    361372    }
    362373
     
    376387    delete gui;
    377388  }
    378   PRINT(0)(" --benchmark:\t\t\tstarts the orxonox benchmark\n");
    379   PRINT(0)(" --help: \t\t\tshows this help\n");
     389  PRINT(0)(" -b|--benchmark:\t\tstarts the orxonox benchmark\n");
     390  PRINT(0)(" -h|--help:\t\t\tshows this help\n");
    380391}
    381392
  • orxonox/trunk/src/orxonox.h

    r4132 r4135  
    3939  Uint32 lastframe;           //!< Time of the last Frame
    4040 
     41  unsigned int argc;          //!< Count of Arguments of orxonox
     42  char** argv;                //!< Values of th Arguments of orxonox.
     43 
    4144  void getConfigFile (int argc, char** argv);
    4245 
    43   // main loop functions
    44   //  void synchronize ();
    45   //void handle_input ();
    46   //void time_slice ();
    47   //void collision ();
    48   //void display ();
    49  
    50         // subsystem initialization
     46  // subsystem initialization
    5147  int initVideo ();
    5248  int initSound ();
Note: See TracChangeset for help on using the changeset viewer.