Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7749 was 7727, checked in by bensch, 19 years ago

trunk: some GL-properties for the Textures

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