Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2005, 8:41:51 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: importer now uses the graphicsEngine to generate a Window → orxonox gets modular

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/subprojects/importer/framework.cc

    r4263 r4272  
    1919
    2020#include "primitive_model.h"
     21#include "debug.h"
     22#include "graphics_engine.h"
     23
    2124
    2225
     
    6164
    6265  Uint8* keys; // This variable will be used in the keyboard routine
    63   int done=FALSE; // We aren't done yet, are we?
     66  int done = false; // We aren't done yet, are we?
    6467
    6568  // Create a new OpenGL window with the title "Cone3D Basecode" at
    6669  // 640x480x32, fullscreen and check for errors along the way
    67   if(wHandler.CreateGLWindow("Whandler Basecode", 800, 600, 32, FALSE) == FALSE)
    68   {
    69     // If an error is found, display a message, kill the GL and SDL screens (if they were created) and exit
    70     PRINTF(1)("Could not initalize OpenGL :(\n\n");
    71     wHandler.KillGLWindow();
    72     return 0;
    73   }
    74  
    75   PRINTF(2)("screensize: %i, %i\n", wHandler.screen->w, wHandler.screen->h);
     70  GraphicsEngine::getInstance();
     71
    7672  if (argc>=3)
    7773    obj = new OBJModel (argv[1], atof(argv[2]));
     
    8177    obj = new PrimitiveModel(CYLINDER);
    8278
    83   M = Vector(wHandler.screen->w/2, wHandler.screen->h/2, 0);
     79  M = Vector(GraphicsEngine::getInstance()->getResolutionY()/2, GraphicsEngine::getInstance()->getResolutionX()/2, 0);
    8480  rotAxis = Vector (0.0,1.0,0.0);
    8581  rotAngle = 0;
     
    138134            int mX = event.button.x;
    139135            int mY = event.button.y;
    140             int wH = wHandler.screen->h;
    141             int wW = wHandler.screen->w;
     136            int wH = GraphicsEngine::getInstance()->getResolutionY();
     137            int wW = GraphicsEngine::getInstance()->getResolutionX();
    142138            Vector tmpV (mX, mY, sqrt ( (float) abs(wH * wH/4 - (wW/2-mX) * (wW/2-mX) - (wH/2-mY) * (wH/2-mY)) ));
    143139            //      PRINTF(0)("tmpV: %f, %f, %f\n", tmpV.x, tmpV.y, tmpV.z);
     
    182178            int mX = event.button.x;
    183179            int mY = event.button.y;
    184             int wH = wHandler.screen->h;
    185             int wW = wHandler.screen->w;
     180            int wH = GraphicsEngine::getInstance()->getResolutionY();
     181            int wW = GraphicsEngine::getInstance()->getResolutionX();
    186182            Vector tmpV (mX, mY, sqrt ( (float) abs(wH * wH/4 - (wW/2-mX) * (wW/2-mX) - (wH/2-mY) * (wH/2-mY)) ));
    187183            p1 = tmpV-M;
     
    193189            PRINTF(0)("MouseButton %d pressed at (%d,%d).\n",
    194190                   event.button.button, event.button.x, event.button.y);
    195             rotatorV = ( (float)wHandler.screen->w/2 -event.button.x) / (float)wHandler.screen->w / 100.0;
     191            rotatorV = ( (float)GraphicsEngine::getInstance()->getResolutionY()/2 -event.button.x) / (float)GraphicsEngine::getInstance()->getResolutionY() / 100.0;
    196192          }
    197193           
     
    233229      case SDL_QUIT:
    234230        // then we're done and we'll end this program
    235           done=TRUE;
     231          done=true;
    236232          break;
    237233      default:
     
    246242
    247243    // and check if ESCAPE has been pressed. If so then quit
    248     if(keys[SDLK_ESCAPE]) done=TRUE;
     244    if(keys[SDLK_ESCAPE]) done=true;
    249245  }
    250246
     
    252248  if (obj)
    253249    delete obj;
    254   wHandler.KillGLWindow();
     250  delete GraphicsEngine::getInstance();
    255251  // And quit
    256252  return 0;
Note: See TracChangeset for help on using the changeset viewer.