Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6987 was 6980, checked in by patrick, 19 years ago

trunk: lenseflares loadable

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