Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 11, 2005, 12:55:48 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: setClassID implemented in all files

File:
1 edited

Legend:

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

    r4536 r4597  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    2929   \todo this constructor is not jet implemented - do it
    3030*/
    31 GraphicsEngine::GraphicsEngine ()
    32 {
     31GraphicsEngine::GraphicsEngine ()
     32{
     33  this->setClassID(CL_GRAPHICS_ENGINE, "GraphicsEngine");
     34  this->setName("GraphicsEngine");
    3335  this->bDisplayFPS = false;
    3436  this->minFPS = 9999;
    3537  this->maxFPS = 0;
    36   this->setClassID(CL_GRAPHICS_ENGINE, "GraphicsEngine");
    3738
    3839  this->fullscreen = false;
     
    5152   \brief destructs the graphicsEngine.
    5253*/
    53 GraphicsEngine::~GraphicsEngine () 
     54GraphicsEngine::~GraphicsEngine ()
    5455{
    5556  // delete what has to be deleted here
     
    7980  if( videoInfo == NULL)
    8081    {
    81       PRINTF(1)("Failed getting Video Info :%s\n", SDL_GetError()); 
     82      PRINTF(1)("Failed getting Video Info :%s\n", SDL_GetError());
    8283      SDL_Quit ();
    8384    }
    8485  if( videoInfo->hw_available)
    8586    this->videoFlags |= SDL_HWSURFACE;
    86   else 
     87  else
    8788    this->videoFlags |= SDL_SWSURFACE;
    8889  /*
     
    9394  // setting up the Resolution
    9495  this->setResolution(800, 600, 16);
    95  
     96
    9697  // Set window labeling
    9798  SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
    98  
     99
    99100  // TO DO: Create a cool icon and use it here
    100101  char* loadPic = new char[strlen(ResourceManager::getInstance()->getDataDir())+ 100];
    101102  sprintf(loadPic, "%s%s", ResourceManager::getInstance()->getDataDir(),  "pictures/orxonox-icon32x32.bmp");
    102   SDL_WM_SetIcon(SDL_LoadBMP(loadPic), NULL); 
     103  SDL_WM_SetIcon(SDL_LoadBMP(loadPic), NULL);
    103104  delete loadPic;
    104105  // Enable default GL stuff
     
    117118  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
    118119  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    119  
    120 
    121   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
    122   SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);   
    123   SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); 
     120
     121
     122  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
     123  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);
     124  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);
    124125  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
    125126  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
     
    144145  else
    145146    fullscreenFlag = 0;
    146  
     147
    147148  printf ("ok\n");
    148149  if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags | fullscreenFlag)) == NULL)
     
    195196/**
    196197   \brief entering 2D Mode
    197    
     198
    198199   this is a GL-Projection-mode, that is orthogonal, for placing the font in fron of everything else
    199200*/
     
    202203  GraphicsEngine::storeMatrices();
    203204  SDL_Surface *screen = SDL_GetVideoSurface();
    204  
     205
    205206  /* Note, there may be other things you need to change,
    206207     depending on how you have your OpenGL state set up.
     
    215216  glEnable(GL_BLEND);
    216217  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    217  
     218
    218219  glViewport(0, 0, screen->w, screen->h);
    219  
     220
    220221  glMatrixMode(GL_PROJECTION);
    221222  glPushMatrix();
    222223  glLoadIdentity();
    223  
     224
    224225  glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0);
    225  
     226
    226227  glMatrixMode(GL_MODELVIEW);
    227228  glPushMatrix();
    228229  glLoadIdentity();
    229  
     230
    230231  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    231232}
     
    238239  glMatrixMode(GL_MODELVIEW);
    239240  glPopMatrix();
    240  
     241
    241242  glMatrixMode(GL_PROJECTION);
    242243  glPopMatrix();
    243  
     244
    244245  glPopAttrib();
    245246}
    246247
    247248/**
    248    \brief stores the GL_matrices 
     249   \brief stores the GL_matrices
    249250*/
    250251void GraphicsEngine::storeMatrices(void)
     
    271272  /* Get available fullscreen/hardware modes */
    272273  this->videoModes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
    273  
     274
    274275  /* Check is there are any modes available */
    275276  if(this->videoModes == (SDL_Rect **)0){
     
    277278    exit(-1);
    278279  }
    279  
     280
    280281  /* Check if our resolution is restricted */
    281282  if(this->videoModes == (SDL_Rect **)-1){
     
    301302      if( unlikely(this->currentFPS > this->maxFPS)) this->maxFPS = this->currentFPS;
    302303      if( unlikely(this->currentFPS < this->minFPS)) this->minFPS = this->currentFPS;
    303      
     304
    304305#ifndef NO_TEXT
    305306      char tmpChar1[20];
     
    315316    }
    316317}
    317  
     318
    318319/**
    319320   \brief displays the Frames per second
     
    335336      this->geTextMinFPS = TextEngine::getInstance()->createText("fonts/druid.ttf", 35, TEXT_DYNAMIC, 0, 255, 0);
    336337      this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
    337       this->geTextMinFPS->setPosition(5, 560); 
     338      this->geTextMinFPS->setPosition(5, 560);
    338339#endif /* NO_TEXT */
    339340    }
     
    341342}
    342343
    343  
     344
Note: See TracChangeset for help on using the changeset viewer.