Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6362 was 6222, checked in by bensch, 19 years ago

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