Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/graphics_engine.cc @ 6219

Last change on this file since 6219 was 6162, checked in by bensch, 19 years ago

orxonox/trunk: merged the spaceshipcontroll branche into the trunk
merged with command
svn merge -r6036:HEAD spaceshipcontrol/ ../trunk/
no conflicts

File size: 16.4 KB
RevLine 
[4597]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
[1855]10
11   ### File Specific:
[3610]12   main-programmer: Benjamin Grauer
[1855]13   co-programmer: ...
[1853]14*/
15
[3610]16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
[1853]17
[3610]18#include "graphics_engine.h"
[4094]19#include "resource_manager.h"
[4817]20#include "event_handler.h"
[1853]21
[6142]22#include "world_entity.h"
23
[4849]24#include "render_2d.h"
[5347]25#include "text_engine.h"
[4850]26#include "light.h"
[5347]27#include "shader.h"
[3611]28#include "debug.h"
[5347]29
[5944]30#include "parser/ini_parser/ini_parser.h"
[4770]31#include "substring.h"
[5344]32#include "text.h"
[4770]33
[5819]34#include "globals.h"
[5857]35#include "texture.h"
[5755]36
37#ifdef __WIN32__
38 #include "class_list.h"
39 #include "list.h"
[6162]40 #include "static_model.h"
[5755]41#endif
[1856]42using namespace std;
[1853]43
[3245]44/**
[4836]45 *  standard constructor
[5262]46 */
[4597]47GraphicsEngine::GraphicsEngine ()
[3365]48{
[4597]49  this->setClassID(CL_GRAPHICS_ENGINE, "GraphicsEngine");
50  this->setName("GraphicsEngine");
[4784]51
52  this->isInit = false;
53
[4245]54  this->bDisplayFPS = false;
55  this->minFPS = 9999;
56  this->maxFPS = 0;
[4135]57
[5079]58  this->geTextCFPS = NULL;
59  this->geTextMaxFPS = NULL;
60  this->geTextMinFPS = NULL;
61
[4768]62  this->fullscreenFlag = 0;
[5225]63  this->videoFlags = 0;
64  this->screen = NULL;
[5260]65
66
67  // Hardware
68  this->hwRenderer = NULL;
69  this->hwVendor = NULL;
70  this->hwVersion = NULL;
71  this->hwExtensions = NULL;
[5285]72
73  // initialize the TextEngine
74  TextEngine::getInstance();
[3611]75}
[3610]76
[3621]77/**
[4836]78 *  The Pointer to this GraphicsEngine
[3621]79*/
[3611]80GraphicsEngine* GraphicsEngine::singletonRef = NULL;
[3610]81
[3621]82/**
[4836]83 *  destructs the graphicsEngine.
[3611]84*/
[4597]85GraphicsEngine::~GraphicsEngine ()
[3611]86{
87  // delete what has to be deleted here
[5079]88  delete this->geTextCFPS;
89  delete this->geTextMaxFPS;
90  delete this->geTextMinFPS;
[4849]91
[5260]92  delete[] this->hwRenderer;
93  delete[] this->hwVendor;
94  delete[] this->hwVersion;
95  delete this->hwExtensions;
96
[5286]97  //TextEngine
[5285]98  delete TextEngine::getInstance();
[5347]99  // render 2D
100  delete Render2D::getInstance();
[5079]101
[5225]102  SDL_QuitSubSystem(SDL_INIT_VIDEO);
[5242]103//   if (this->screen != NULL)
104//     SDL_FreeSurface(this->screen);
[5240]105
[4849]106  GraphicsEngine::singletonRef = NULL;
[3611]107}
108
[4830]109/**
110 * initializes the GraphicsEngine with default settings.
111 */
[4784]112int GraphicsEngine::init()
113{
[4830]114  if (this->isInit)
115    return -1;
116  this->initVideo(640, 480, 16);
[4784]117}
118
[3611]119/**
[4830]120 * loads the GraphicsEngine's settings from a given ini-file and section
121 * @param iniParser the iniParser to load from
122 * @param section the Section in the ini-file to load from
123 * @returns nothing usefull
124 */
125int GraphicsEngine::initFromIniFile(IniParser* iniParser)
126{
127  // looking if we are in fullscreen-mode
128  const char* fullscreen = iniParser->getVar(CONFIG_NAME_FULLSCREEN, CONFIG_SECTION_VIDEO, "0");
[5417]129  if (strchr(fullscreen, '1') || !strcasecmp(fullscreen, "true"))
[4830]130    this->fullscreenFlag = SDL_FULLSCREEN;
131
132  // looking if we are in fullscreen-mode
133  const char* textures = iniParser->getVar(CONFIG_NAME_TEXTURES, CONFIG_SECTION_VIDEO_ADVANCED, "0");
[5417]134  if (strchr(textures, '1') || !strcasecmp(textures, "true"))
[5857]135    Texture::setTextureEnableState( true);
[4830]136  else
[5857]137    Texture::setTextureEnableState(false);
[4830]138
139  // searching for a usefull resolution
[4835]140  SubString resolution(iniParser->getVar(CONFIG_NAME_RESOLUTION, CONFIG_SECTION_VIDEO, "640x480"), 'x');
[4833]141  //resolution.debug();
142
[4835]143  this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);
[4830]144}
145
146
147
148/**
[4836]149 *  initializes the Video for openGL.
[5346]150 *
151 * This has to be done only once when starting orxonox.
152 */
[4784]153int GraphicsEngine::initVideo(unsigned int resX, unsigned int resY, unsigned int bbp)
[3611]154{
[4784]155  if (this->isInit)
156    return -1;
[5024]157  //   initialize SDL_VIDEO
[5225]158  if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
[5024]159  {
160    PRINTF(1)("could not initialize SDL Video\n");
[3610]161      //      return -1;
[5024]162  }
[3617]163  // initialize SDL_GL-settings
164  this->setGLattribs();
[3610]165
[3617]166  // setting the Video Flags.
[5225]167  this->videoFlags = SDL_OPENGL | SDL_HWPALETTE | SDL_RESIZABLE | SDL_DOUBLEBUF | SDL_GL_DOUBLEBUFFER;
[3610]168
169  /* query SDL for information about our video hardware */
170  const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo ();
171  if( videoInfo == NULL)
172    {
[4597]173      PRINTF(1)("Failed getting Video Info :%s\n", SDL_GetError());
[3610]174      SDL_Quit ();
175    }
176  if( videoInfo->hw_available)
[3611]177    this->videoFlags |= SDL_HWSURFACE;
[4597]178  else
[3611]179    this->videoFlags |= SDL_SWSURFACE;
[3610]180  /*
[3619]181  if(VideoInfo -> blit_hw)
[3610]182    VideoFlags |= SDL_HWACCEL;
183  */
[4739]184    // setting up the Resolution
[4784]185  this->setResolution(resX, resY, bbp);
[3611]186
[5260]187  // GRABBING ALL GL-extensions
188  this->grabHardwareSettings();
189
[3621]190  // Enable default GL stuff
191  glEnable(GL_DEPTH_TEST);
[4784]192
[4849]193  Render2D::getInstance();
[4833]194
[4784]195  this->isInit = true;
[3365]196}
[1853]197
[4770]198/**
[4619]199 * sets the Window Captions and the Name of the icon.
200 * @param windowName The name of the Window
201 * @param icon The name of the Icon on the Disc
202 */
203void GraphicsEngine::setWindowName(const char* windowName, const char* icon)
204{
[5216]205  SDL_Surface* iconSurf = SDL_LoadBMP(icon);
[5240]206  if (iconSurf != NULL)
207  {
[5241]208    Uint32 colorkey = SDL_MapRGB(iconSurf->format, 0, 0, 0);
[5240]209    SDL_SetColorKey(iconSurf, SDL_SRCCOLORKEY, colorkey);
210    SDL_WM_SetIcon(iconSurf,NULL);
211    SDL_FreeSurface(iconSurf);
212  }
[5024]213
[4619]214  SDL_WM_SetCaption (windowName, icon);
215}
216
217
218/**
[4836]219 *  Sets the GL-attributes
[5346]220 */
[4746]221int GraphicsEngine::setGLattribs()
[3617]222{
223  // Set video mode
224  // TO DO: parse arguments for settings
225  //SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
226  //SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
227  //SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
228  //SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
229
[4597]230
231  SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
232  SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16);
233  SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0);
[3617]234  SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0);
235  SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0);
236  SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0);
237  SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0);
238}
239
[5261]240/**
241 * grabs the Hardware Specifics
242 * checks for all the different HW-types
243 */
[5260]244void GraphicsEngine::grabHardwareSettings()
245{
246  const char* renderer = (const char*) glGetString(GL_RENDERER);
247  const char* vendor   = (const char*) glGetString(GL_VENDOR);
248  const char* version  = (const char*) glGetString(GL_VERSION);
249  const char* extensions = (const char*) glGetString(GL_EXTENSIONS);
250
251//  printf("%s %s %s\n %s", renderer, vendor, version, extensions);
252
253  if (this->hwRenderer == NULL && renderer != NULL)
254  {
255    this->hwRenderer = new char[strlen(renderer)+1];
256    strcpy(this->hwRenderer, renderer);
257  }
258  if (this->hwVendor == NULL && vendor != NULL)
259  {
260    this->hwVendor = new char[strlen(vendor)+1];
261    strcpy(this->hwVendor, vendor);
262  }
263  if (this->hwVersion == NULL && version != NULL)
264  {
265    this->hwVersion = new char[strlen(version)+11];
266    strcpy(this->hwVersion, version);
267  }
268
269  if (this->hwExtensions == NULL && extensions != NULL)
[5656]270    this->hwExtensions = new SubString((char*)glGetString(GL_EXTENSIONS), " \n\t,");
[5260]271
272  PRINT(4)("Running on : %s %s %s\n", vendor, renderer, version);
273  PRINT(4)("Extensions:\n");
274  if (this->hwExtensions != NULL)
275    for (unsigned int i = 0; i < this->hwExtensions->getCount(); i++)
276      PRINT(4)("%d: %s\n", i, this->hwExtensions->getString(i));
[5263]277
278
279  // inizializing GLEW
280  GLenum err = glewInit();
281  if (GLEW_OK != err)
282  {
283    /* Problem: glewInit failed, something is seriously wrong. */
284    PRINTF(1)("%s\n", glewGetErrorString(err));
285  }
286  PRINTF(4)("Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
[5260]287}
288
[6162]289
[3621]290/**
[4836]291 *  sets the Resolution of the Screen to display the Graphics to.
292 * @param width The width of the window
293 * @param height The height of the window
294 * @param bpp bits per pixel
[5346]295 */
[3619]296int GraphicsEngine::setResolution(int width, int height, int bpp)
[3610]297{
[3611]298  this->resolutionX = width;
299  this->resolutionY = height;
300  this->bitsPerPixel = bpp;
[4739]301
[5255]302  if (this->screen != NULL)
[5237]303    SDL_FreeSurface(screen);
[4769]304  if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags | this->fullscreenFlag)) == NULL)
[3611]305    {
306      PRINTF(1)("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags, SDL_GetError());
[5216]307      //    SDL_Quit();
[3611]308      //    return -1;
309    }
[5266]310    glMatrixMode(GL_PROJECTION_MATRIX);
311    glLoadIdentity();
[5509]312    glViewport(0, 0, width, height);                     // Reset The Current Viewport
[5755]313
[5790]314#ifdef __WIN32__
[5755]315    // REBUILDING TEXTURES (ON WINDOWS CONTEXT SWITCH)
[6011]316    const std::list<BaseObject*>* texList = ClassList::getList(CL_TEXTURE);
[5755]317    if (texList != NULL)
[5790]318    {
[6011]319      std::list<BaseObject*>::const_iterator reTex;
[5790]320      for (reTex = texList->begin(); reTex != texList->end(); reTex++)
321        dynamic_cast<Texture*>(*reTex)->rebuild();
322    }
323    // REBUILDING MODELS
[6162]324    const std::list<BaseObject*>* modelList = ClassList::getList(CL_STATIC_MODEL);
[5790]325    if (texList != NULL)
326    {
[6011]327      std::list<BaseObject*>::const_iterator reModel;
[5790]328      for (reModel = modelList->begin(); reModel != modelList->end(); reModel++)
[6162]329        dynamic_cast<StaticModel*>(*reModel)->rebuild();
[5790]330    }
[5755]331#endif /* __WIN32__ */
[4135]332}
[3610]333
[4458]334/**
[4836]335 *  sets Fullscreen mode
336 * @param fullscreen true if fullscreen, false if windowed
[4458]337*/
[4135]338void GraphicsEngine::setFullscreen(bool fullscreen)
339{
[4768]340  if (fullscreen)
[5789]341    this->fullscreenFlag = SDL_FULLSCREEN;
[4768]342  else
[5789]343    this->fullscreenFlag = 0;
[4135]344  this->setResolution(this->resolutionX, this->resolutionY, this->bitsPerPixel);
[3543]345}
[3617]346
[4458]347/**
[4836]348 *  sets the background color
349 * @param red the red part of the background
350 * @param blue the blue part of the background
351 * @param green the green part of the background
352 * @param alpha the alpha part of the background
[5346]353 */
[4374]354void GraphicsEngine::setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
355{
356  glClearColor(red, green, blue, alpha);
357}
358
[3621]359/**
[4836]360 *  Signalhandler, for when the resolution has changed
361 * @param resizeInfo SDL information about the size of the new screen size
[5346]362 */
[4782]363int GraphicsEngine::resolutionChanged(const SDL_ResizeEvent& resizeInfo)
[3619]364{
[4782]365  this->setResolution(resizeInfo.w, resizeInfo.h, this->bitsPerPixel);
[3619]366}
[3617]367
[3622]368/**
[4833]369 *
370 * @param show if The mouse-cursor should be visible
371 */
372void GraphicsEngine::showMouse(bool show)
373{
374  if (show)
375    SDL_ShowCursor(SDL_ENABLE);
376  else
377    SDL_ShowCursor(SDL_DISABLE);
378}
379
380/**
381 *
382 * @returns The Visinility of the mouse-cursor (true if visible, false if it is invisible)
383 */
384bool GraphicsEngine::isMouseVisible()
385{
386  if (SDL_ShowCursor(SDL_QUERY) == SDL_ENABLE)
387    return true;
388  else
389    return false;
390}
391
392/**
393 *
394 * @param steal If the Winodow-Managers Events should be stolen to this app
395 * (steals the mouse, and all WM-clicks)
396 *
397 * This only happens, if the HARD-Debug-level is set to 0,1,2, because otherwise a Segfault could
398 * result in the loss of System-controll
399 */
400void GraphicsEngine::stealWMEvents(bool steal)
401{
402#if DEBUG < 3
403   if (steal)
404     SDL_WM_GrabInput(SDL_GRAB_ON);
[4864]405   else
406     SDL_WM_GrabInput(SDL_GRAB_OFF);
[4833]407#endif
408}
409
410/**
411 *
412 * @returns true if Events are stolen from the WM, false if not.
413 */
414bool GraphicsEngine::isStealingEvents()
415{
416   if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)
417     return true;
418   else
419     return false;
420};
421
422/**
[4836]423 *  entering 2D Mode
[4597]424
[3790]425   this is a GL-Projection-mode, that is orthogonal, for placing the font in fron of everything else
426*/
[4746]427void GraphicsEngine::enter2DMode()
[3790]428{
[4955]429  //GraphicsEngine::storeMatrices();
[3790]430  SDL_Surface *screen = SDL_GetVideoSurface();
[4597]431
[3790]432  /* Note, there may be other things you need to change,
433     depending on how you have your OpenGL state set up.
434  */
435  glPushAttrib(GL_ENABLE_BIT);
436  glDisable(GL_DEPTH_TEST);
437  glDisable(GL_CULL_FACE);
438  glDisable(GL_LIGHTING);  // will be set back when leaving 2D-mode
[3617]439
[3790]440  glViewport(0, 0, screen->w, screen->h);
[4597]441
[3790]442  glMatrixMode(GL_PROJECTION);
443  glPushMatrix();
444  glLoadIdentity();
[4597]445
[3790]446  glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0);
[4597]447
[3790]448  glMatrixMode(GL_MODELVIEW);
449  glPushMatrix();
450  glLoadIdentity();
[4597]451
[3790]452  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
453}
[3617]454
[3790]455/**
[5346]456 *  leaves the 2DMode again also @see Font::enter2DMode()
457 */
[4746]458void GraphicsEngine::leave2DMode()
[3790]459{
[4834]460  glMatrixMode(GL_PROJECTION);
[3790]461  glPopMatrix();
[4597]462
[4834]463  glMatrixMode(GL_MODELVIEW);
[3790]464  glPopMatrix();
[4597]465
[3790]466  glPopAttrib();
467}
[3622]468
[3844]469/**
[4836]470 *  stores the GL_matrices
[5346]471 */
[4746]472void GraphicsEngine::storeMatrices()
[3844]473{
474  glGetDoublev(GL_PROJECTION_MATRIX, GraphicsEngine::projMat);
475  glGetDoublev(GL_MODELVIEW_MATRIX, GraphicsEngine::modMat);
476  glGetIntegerv(GL_VIEWPORT, GraphicsEngine::viewPort);
477}
[3622]478
[3844]479//! the stored ModelView Matrix.
480GLdouble GraphicsEngine::modMat[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
481//! the stored Projection Matrix
482GLdouble GraphicsEngine::projMat[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
483//! The ViewPort
484GLint GraphicsEngine::viewPort[4] = {0,0,0,0};
[3790]485
486
[3844]487
[3617]488/**
[4836]489 *  outputs all the Fullscreen modes.
[5346]490 */
[4746]491void GraphicsEngine::listModes()
[3617]492{
493  /* Get available fullscreen/hardware modes */
494  this->videoModes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
[4597]495
[3617]496  /* Check is there are any modes available */
497  if(this->videoModes == (SDL_Rect **)0){
498    PRINTF(1)("No modes available!\n");
499    exit(-1);
500  }
[4597]501
[3617]502  /* Check if our resolution is restricted */
503  if(this->videoModes == (SDL_Rect **)-1){
[4135]504    PRINTF(2)("All resolutions available.\n");
[3617]505  }
506  else{
507    /* Print valid modes */
508    PRINT(0)("Available Resoulution Modes are\n");
509    for(int i = 0; this->videoModes[i]; ++i)
[4135]510      PRINT(4)(" |  %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h);
[3617]511  }
[4245]512}
513
[4458]514/**
[5261]515 * checks wether a certain extension is availiable
516 * @param extension the Extension to check for (ex. GL_ARB_texture_env_dot3)
517 * @return true if it is, false otherwise
518 */
519bool GraphicsEngine::hwSupportsEXT(const char* extension)
520{
521  if (this->hwExtensions != NULL)
522    for (unsigned int i = 0; i < this->hwExtensions->getCount(); i++)
523      if (!strcmp(extension, this->hwExtensions->getString(i)))
524        return true;
525  return false;
526}
527
528/**
[5084]529 * updates everything that is to be updated in the GraphicsEngine
530 */
531void GraphicsEngine::update(float dt)
532{
[5406]533  Render2D::getInstance()->update(dt);
[5084]534}
535
536
537/**
[4836]538 *  ticks the Text
539 * @param dt the time passed
[5346]540 */
541void GraphicsEngine::tick(float dt)
[4245]542{
[4458]543  if( unlikely(this->bDisplayFPS))
[4849]544  {
545    this->currentFPS = 1.0/dt;
546    if( unlikely(this->currentFPS > this->maxFPS)) this->maxFPS = this->currentFPS;
547    if( unlikely(this->currentFPS < this->minFPS)) this->minFPS = this->currentFPS;
[4597]548
[4536]549#ifndef NO_TEXT
[4458]550      char tmpChar1[20];
551      sprintf(tmpChar1, "Current:  %4.0f", this->currentFPS);
552      this->geTextCFPS->setText(tmpChar1);
553      char tmpChar2[20];
554      sprintf(tmpChar2, "Max:    %4.0f", this->maxFPS);
555      this->geTextMaxFPS->setText(tmpChar2);
556      char tmpChar3[20];
557      sprintf(tmpChar3, "Min:    %4.0f", this->minFPS);
558      this->geTextMinFPS->setText(tmpChar3);
[4536]559#endif /* NO_TEXT */
[4849]560
561
562  }
563  Render2D::getInstance()->tick(dt);
[4245]564}
[4597]565
[4849]566
567void GraphicsEngine::draw() const
568{
[5417]569  LightManager::getInstance()->draw();
[4955]570  GraphicsEngine::storeMatrices();
[5318]571  Shader::suspendShader();
[5417]572
[5397]573  Render2D::getInstance()->draw(E2D_LAYER_ALL);
[5318]574  Shader::restoreShader();
[4849]575}
576
[6142]577void GraphicsEngine::draw(const std::list<WorldEntity*>& drawList ) const
578{
579  std::list<WorldEntity*>::const_iterator entity;
580  for (entity = drawList.begin(); entity != drawList.end(); entity++)
581    if ((*entity)->isVisible()) 
582      (*entity)->draw(); 
583}
584
585
[4458]586/**
[5346]587 * displays the Frames per second
[4836]588 * @param display if the text should be displayed
[4458]589*/
[4245]590void GraphicsEngine::displayFPS(bool display)
591{
[4536]592#ifndef NO_TEXT
[5346]593  if( display )
[5079]594{
[5346]595  if (this->geTextCFPS == NULL)
596  {
[5767]597    this->geTextCFPS = new Text("fonts/arial_black.ttf", 15);
[5346]598    this->geTextCFPS->setName("curFPS");
599    this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT);
[5421]600    this->geTextCFPS->setAbsCoor2D(5, 0);
[5346]601  }
602  if (this->geTextMaxFPS == NULL)
603  {
[5767]604    this->geTextMaxFPS = new Text("fonts/arial_black.ttf", 15);
[5346]605    this->geTextMaxFPS->setName("MaxFPS");
606    this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT);
[5421]607    this->geTextMaxFPS->setAbsCoor2D(5, 20);
[5346]608  }
609  if (this->geTextMinFPS == NULL)
610  {
[5767]611    this->geTextMinFPS = new Text("fonts/arial_black.ttf", 15);
[5346]612    this->geTextMinFPS->setName("MinFPS");
613    this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
[5421]614    this->geTextMinFPS->setAbsCoor2D(5, 40);
[5346]615  }
[5079]616}
[5346]617else
[5079]618{
[5346]619  delete this->geTextCFPS;
620  this->geTextCFPS = NULL;
621  delete this->geTextMaxFPS;
622  this->geTextMaxFPS = NULL;
623  delete this->geTextMinFPS;
624  this->geTextMinFPS = NULL;
[5079]625}
[5346]626  this->bDisplayFPS = display;
627#else
628  this->bDisplayFPS = false;
[4536]629#endif /* NO_TEXT */
[3617]630}
[4245]631
[4597]632
[4817]633/**
[5346]634  processes the events for the GraphicsEngine class
[4836]635* @param the event to handle
[4817]636 */
637void GraphicsEngine::process(const Event &event)
638{
639  switch (event.type)
640  {
641    case EV_VIDEO_RESIZE:
642      this->resolutionChanged(event.resize);
643      break;
644  }
645
646}
Note: See TracBrowser for help on using the repository browser.