Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6513 was 6441, checked in by bensch, 19 years ago

orxonox/trunk: the Hud now scales the Widgets itself

File size: 16.5 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"
[6441]21#include "state.h"
[1853]22
[6142]23#include "world_entity.h"
24
[4849]25#include "render_2d.h"
[5347]26#include "text_engine.h"
[4850]27#include "light.h"
[5347]28#include "shader.h"
[3611]29#include "debug.h"
[5347]30
[5944]31#include "parser/ini_parser/ini_parser.h"
[4770]32#include "substring.h"
[5344]33#include "text.h"
[4770]34
[5819]35#include "globals.h"
[5857]36#include "texture.h"
[5755]37
38#ifdef __WIN32__
39 #include "class_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;
[6441]301  State::setResolution( width, height);
[4739]302
[5255]303  if (this->screen != NULL)
[5237]304    SDL_FreeSurface(screen);
[4769]305  if((this->screen = SDL_SetVideoMode(this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags | this->fullscreenFlag)) == NULL)
[3611]306    {
307      PRINTF(1)("Could not SDL_SetVideoMode(%d, %d, %d, %d): %s\n", this->resolutionX, this->resolutionY, this->bitsPerPixel, this->videoFlags, SDL_GetError());
[5216]308      //    SDL_Quit();
[3611]309      //    return -1;
310    }
[5266]311    glMatrixMode(GL_PROJECTION_MATRIX);
312    glLoadIdentity();
[5509]313    glViewport(0, 0, width, height);                     // Reset The Current Viewport
[5755]314
[5790]315#ifdef __WIN32__
[5755]316    // REBUILDING TEXTURES (ON WINDOWS CONTEXT SWITCH)
[6011]317    const std::list<BaseObject*>* texList = ClassList::getList(CL_TEXTURE);
[5755]318    if (texList != NULL)
[5790]319    {
[6011]320      std::list<BaseObject*>::const_iterator reTex;
[5790]321      for (reTex = texList->begin(); reTex != texList->end(); reTex++)
322        dynamic_cast<Texture*>(*reTex)->rebuild();
323    }
324    // REBUILDING MODELS
[6162]325    const std::list<BaseObject*>* modelList = ClassList::getList(CL_STATIC_MODEL);
[5790]326    if (texList != NULL)
327    {
[6011]328      std::list<BaseObject*>::const_iterator reModel;
[5790]329      for (reModel = modelList->begin(); reModel != modelList->end(); reModel++)
[6162]330        dynamic_cast<StaticModel*>(*reModel)->rebuild();
[5790]331    }
[5755]332#endif /* __WIN32__ */
[4135]333}
[3610]334
[4458]335/**
[4836]336 *  sets Fullscreen mode
337 * @param fullscreen true if fullscreen, false if windowed
[4458]338*/
[4135]339void GraphicsEngine::setFullscreen(bool fullscreen)
340{
[4768]341  if (fullscreen)
[5789]342    this->fullscreenFlag = SDL_FULLSCREEN;
[4768]343  else
[5789]344    this->fullscreenFlag = 0;
[4135]345  this->setResolution(this->resolutionX, this->resolutionY, this->bitsPerPixel);
[3543]346}
[3617]347
[4458]348/**
[4836]349 *  sets the background color
350 * @param red the red part of the background
351 * @param blue the blue part of the background
352 * @param green the green part of the background
353 * @param alpha the alpha part of the background
[5346]354 */
[4374]355void GraphicsEngine::setBackgroundColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
356{
357  glClearColor(red, green, blue, alpha);
358}
359
[3621]360/**
[4836]361 *  Signalhandler, for when the resolution has changed
362 * @param resizeInfo SDL information about the size of the new screen size
[5346]363 */
[4782]364int GraphicsEngine::resolutionChanged(const SDL_ResizeEvent& resizeInfo)
[3619]365{
[4782]366  this->setResolution(resizeInfo.w, resizeInfo.h, this->bitsPerPixel);
[3619]367}
[3617]368
[3622]369/**
[4833]370 *
371 * @param show if The mouse-cursor should be visible
372 */
373void GraphicsEngine::showMouse(bool show)
374{
375  if (show)
376    SDL_ShowCursor(SDL_ENABLE);
377  else
378    SDL_ShowCursor(SDL_DISABLE);
379}
380
381/**
382 *
383 * @returns The Visinility of the mouse-cursor (true if visible, false if it is invisible)
384 */
385bool GraphicsEngine::isMouseVisible()
386{
387  if (SDL_ShowCursor(SDL_QUERY) == SDL_ENABLE)
388    return true;
389  else
390    return false;
391}
392
393/**
394 *
395 * @param steal If the Winodow-Managers Events should be stolen to this app
396 * (steals the mouse, and all WM-clicks)
397 *
398 * This only happens, if the HARD-Debug-level is set to 0,1,2, because otherwise a Segfault could
399 * result in the loss of System-controll
400 */
401void GraphicsEngine::stealWMEvents(bool steal)
402{
403#if DEBUG < 3
404   if (steal)
405     SDL_WM_GrabInput(SDL_GRAB_ON);
[4864]406   else
407     SDL_WM_GrabInput(SDL_GRAB_OFF);
[4833]408#endif
409}
410
411/**
412 *
413 * @returns true if Events are stolen from the WM, false if not.
414 */
415bool GraphicsEngine::isStealingEvents()
416{
417   if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON)
418     return true;
419   else
420     return false;
421};
422
423/**
[4836]424 *  entering 2D Mode
[4597]425
[3790]426   this is a GL-Projection-mode, that is orthogonal, for placing the font in fron of everything else
427*/
[4746]428void GraphicsEngine::enter2DMode()
[3790]429{
[4955]430  //GraphicsEngine::storeMatrices();
[3790]431  SDL_Surface *screen = SDL_GetVideoSurface();
[4597]432
[3790]433  /* Note, there may be other things you need to change,
434     depending on how you have your OpenGL state set up.
435  */
436  glPushAttrib(GL_ENABLE_BIT);
437  glDisable(GL_DEPTH_TEST);
438  glDisable(GL_CULL_FACE);
439  glDisable(GL_LIGHTING);  // will be set back when leaving 2D-mode
[3617]440
[3790]441  glViewport(0, 0, screen->w, screen->h);
[4597]442
[3790]443  glMatrixMode(GL_PROJECTION);
444  glPushMatrix();
445  glLoadIdentity();
[4597]446
[3790]447  glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0);
[4597]448
[3790]449  glMatrixMode(GL_MODELVIEW);
450  glPushMatrix();
451  glLoadIdentity();
[4597]452
[3790]453  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
454}
[3617]455
[3790]456/**
[5346]457 *  leaves the 2DMode again also @see Font::enter2DMode()
458 */
[4746]459void GraphicsEngine::leave2DMode()
[3790]460{
[4834]461  glMatrixMode(GL_PROJECTION);
[3790]462  glPopMatrix();
[4597]463
[4834]464  glMatrixMode(GL_MODELVIEW);
[3790]465  glPopMatrix();
[4597]466
[3790]467  glPopAttrib();
468}
[3622]469
[3844]470/**
[4836]471 *  stores the GL_matrices
[5346]472 */
[4746]473void GraphicsEngine::storeMatrices()
[3844]474{
475  glGetDoublev(GL_PROJECTION_MATRIX, GraphicsEngine::projMat);
476  glGetDoublev(GL_MODELVIEW_MATRIX, GraphicsEngine::modMat);
477  glGetIntegerv(GL_VIEWPORT, GraphicsEngine::viewPort);
478}
[3622]479
[3844]480//! the stored ModelView Matrix.
481GLdouble GraphicsEngine::modMat[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
482//! the stored Projection Matrix
483GLdouble GraphicsEngine::projMat[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
484//! The ViewPort
485GLint GraphicsEngine::viewPort[4] = {0,0,0,0};
[3790]486
487
[3844]488
[3617]489/**
[4836]490 *  outputs all the Fullscreen modes.
[5346]491 */
[4746]492void GraphicsEngine::listModes()
[3617]493{
494  /* Get available fullscreen/hardware modes */
495  this->videoModes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
[4597]496
[3617]497  /* Check is there are any modes available */
498  if(this->videoModes == (SDL_Rect **)0){
499    PRINTF(1)("No modes available!\n");
500    exit(-1);
501  }
[4597]502
[3617]503  /* Check if our resolution is restricted */
504  if(this->videoModes == (SDL_Rect **)-1){
[4135]505    PRINTF(2)("All resolutions available.\n");
[3617]506  }
507  else{
508    /* Print valid modes */
509    PRINT(0)("Available Resoulution Modes are\n");
510    for(int i = 0; this->videoModes[i]; ++i)
[4135]511      PRINT(4)(" |  %d x %d\n", this->videoModes[i]->w, this->videoModes[i]->h);
[3617]512  }
[4245]513}
514
[4458]515/**
[5261]516 * checks wether a certain extension is availiable
517 * @param extension the Extension to check for (ex. GL_ARB_texture_env_dot3)
518 * @return true if it is, false otherwise
519 */
520bool GraphicsEngine::hwSupportsEXT(const char* extension)
521{
522  if (this->hwExtensions != NULL)
523    for (unsigned int i = 0; i < this->hwExtensions->getCount(); i++)
524      if (!strcmp(extension, this->hwExtensions->getString(i)))
525        return true;
526  return false;
527}
528
529/**
[5084]530 * updates everything that is to be updated in the GraphicsEngine
531 */
532void GraphicsEngine::update(float dt)
533{
[5406]534  Render2D::getInstance()->update(dt);
[5084]535}
536
537
538/**
[4836]539 *  ticks the Text
540 * @param dt the time passed
[5346]541 */
542void GraphicsEngine::tick(float dt)
[4245]543{
[4458]544  if( unlikely(this->bDisplayFPS))
[4849]545  {
546    this->currentFPS = 1.0/dt;
547    if( unlikely(this->currentFPS > this->maxFPS)) this->maxFPS = this->currentFPS;
548    if( unlikely(this->currentFPS < this->minFPS)) this->minFPS = this->currentFPS;
[4597]549
[4536]550#ifndef NO_TEXT
[4458]551      char tmpChar1[20];
552      sprintf(tmpChar1, "Current:  %4.0f", this->currentFPS);
553      this->geTextCFPS->setText(tmpChar1);
554      char tmpChar2[20];
555      sprintf(tmpChar2, "Max:    %4.0f", this->maxFPS);
556      this->geTextMaxFPS->setText(tmpChar2);
557      char tmpChar3[20];
558      sprintf(tmpChar3, "Min:    %4.0f", this->minFPS);
559      this->geTextMinFPS->setText(tmpChar3);
[4536]560#endif /* NO_TEXT */
[4849]561
562
563  }
564  Render2D::getInstance()->tick(dt);
[4245]565}
[4597]566
[4849]567
568void GraphicsEngine::draw() const
569{
[5417]570  LightManager::getInstance()->draw();
[4955]571  GraphicsEngine::storeMatrices();
[5318]572  Shader::suspendShader();
[5417]573
[5397]574  Render2D::getInstance()->draw(E2D_LAYER_ALL);
[5318]575  Shader::restoreShader();
[4849]576}
577
[6142]578void GraphicsEngine::draw(const std::list<WorldEntity*>& drawList ) const
579{
580  std::list<WorldEntity*>::const_iterator entity;
581  for (entity = drawList.begin(); entity != drawList.end(); entity++)
[6222]582    if ((*entity)->isVisible())
583      (*entity)->draw();
[6142]584}
585
586
[4458]587/**
[5346]588 * displays the Frames per second
[4836]589 * @param display if the text should be displayed
[4458]590*/
[4245]591void GraphicsEngine::displayFPS(bool display)
592{
[4536]593#ifndef NO_TEXT
[5346]594  if( display )
[5079]595{
[5346]596  if (this->geTextCFPS == NULL)
597  {
[5767]598    this->geTextCFPS = new Text("fonts/arial_black.ttf", 15);
[5346]599    this->geTextCFPS->setName("curFPS");
600    this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT);
[5421]601    this->geTextCFPS->setAbsCoor2D(5, 0);
[5346]602  }
603  if (this->geTextMaxFPS == NULL)
604  {
[5767]605    this->geTextMaxFPS = new Text("fonts/arial_black.ttf", 15);
[5346]606    this->geTextMaxFPS->setName("MaxFPS");
607    this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT);
[5421]608    this->geTextMaxFPS->setAbsCoor2D(5, 20);
[5346]609  }
610  if (this->geTextMinFPS == NULL)
611  {
[5767]612    this->geTextMinFPS = new Text("fonts/arial_black.ttf", 15);
[5346]613    this->geTextMinFPS->setName("MinFPS");
614    this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT);
[5421]615    this->geTextMinFPS->setAbsCoor2D(5, 40);
[5346]616  }
[5079]617}
[5346]618else
[5079]619{
[5346]620  delete this->geTextCFPS;
621  this->geTextCFPS = NULL;
622  delete this->geTextMaxFPS;
623  this->geTextMaxFPS = NULL;
624  delete this->geTextMinFPS;
625  this->geTextMinFPS = NULL;
[5079]626}
[5346]627  this->bDisplayFPS = display;
628#else
629  this->bDisplayFPS = false;
[4536]630#endif /* NO_TEXT */
[3617]631}
[4245]632
[4597]633
[4817]634/**
[5346]635  processes the events for the GraphicsEngine class
[4836]636* @param the event to handle
[4817]637 */
638void GraphicsEngine::process(const Event &event)
639{
640  switch (event.type)
641  {
642    case EV_VIDEO_RESIZE:
643      this->resolutionChanged(event.resize);
644      break;
645  }
646
647}
Note: See TracBrowser for help on using the repository browser.