Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6533 was 6523, checked in by bensch, 19 years ago

trunk: water fake render :)

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