Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3610 in orxonox.OLD for orxonox/trunk/src/orxonox.cc


Ignore:
Timestamp:
Mar 21, 2005, 1:36:16 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: first definition of the Grahpics-class. more to follow, (and to read about)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/orxonox.cc

    r3592 r3610  
    2525
    2626#include "orxonox.h"
     27
    2728#include "world.h"
    2829#include "camera.h"
     
    3031#include "command_node.h"
    3132#include "game_loader.h"
     33#include "graphics_engine.h"
     34
    3235#include <string.h>
    3336int verbose = 4;
     
    111114{
    112115  printf("> Initializing video\n");
    113   if (SDL_Init(SDL_INIT_VIDEO) == -1)
    114     {
    115       printf ("could not initialize SDL Video\n");
    116       return -1;
    117     }
    118   // Set video mode
    119   // TO DO: parse arguments for settings
    120   //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
    121   //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
    122   //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
    123   //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
    124  
    125 
    126   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );   
    127   SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);   
    128   SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0); 
    129   SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
    130   SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
    131   SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
    132   SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
    133 
    134 
    135 
    136   int bpp = 16;
    137   int width = 640;
    138   int height = 480;
    139   //Uint32 flags = SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER; /* \todo: SDL_OPENGL doen't permit to load images*/
    140   //Uint32 flags = SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER;
    141 
    142   Uint32 videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE;
    143 
    144   /* query SDL for information about our video hardware */
    145   const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
    146  
    147   if( videoInfo == NULL)
    148     {
    149       printf ("Orxonox::initVideo() - Failed getting Video Info :%s\n", SDL_GetError());
    150       SDL_Quit ();
    151     }
    152   if( videoInfo->hw_available)
    153     videoFlags |= SDL_HWSURFACE;
    154   else
    155     videoFlags |= SDL_SWSURFACE;
    156   /*
    157   if(VideoInfo -> blit_hw)                           
    158     VideoFlags |= SDL_HWACCEL;
    159   */
    160  
    161   if((this->screen = SDL_SetVideoMode (width, height, bpp, videoFlags)) == NULL)
    162   {
    163     printf("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", width, height, bpp, videoFlags, SDL_GetError());
    164     SDL_Quit();
    165     return -1;
    166   }
    167  
    168   // Set window labeling
    169   SDL_WM_SetCaption ("Orxonox " PACKAGE_VERSION, "Orxonox " PACKAGE_VERSION);
    170  
    171   // TO DO: Create a cool icon and use it here
    172   // SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); 
    173 
     116 
     117  GraphicsEngine::getInstance();
     118 
    174119  return 0;
    175120}
Note: See TracChangeset for help on using the changeset viewer.