Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1879 in orxonox.OLD for orxonox/trunk/core/orxonox.cc


Ignore:
Timestamp:
May 8, 2004, 1:12:33 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: perspective view, key-repeat bug fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/core/orxonox.cc

    r1875 r1879  
    5454bool Orxonox::rightWeGo = false;
    5555bool Orxonox::leftWeGo = false;
     56int Orxonox::alpha = 0;
     57int Orxonox::beta = 0;
     58//int Orxonox::offsetX = 0;
     59//int Orxonox::offsetY = 0;
    5660
    5761Orxonox* Orxonox::getInstance (void)
     
    6872  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
    6973  glutInitWindowSize(500, 500);
     74  //glutFullScreen();
    7075  glutInitWindowPosition(100, 100);
    7176  glutCreateWindow("orxOnox");
     
    9398  //  (*localPlayer).addIO(io);
    9499
    95   glutIgnoreKeyRepeat(1);                 /* for win32 */
    96   glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF);  /* for linux X11 */
     100  //glutIgnoreKeyRepeat(1);                 /* for win32 */
     101  //glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF);  /* for linux X11 */
    97102  glutSpecialFunc(specFunc);
    98103  glutSpecialUpFunc(releaseKey);
     
    107112{
    108113  switch(key) {
     114
     115    /* perspectiv control */
     116  case 'w':
     117    beta -= 1;
     118    break;
     119  case 's':
     120    beta += 1;
     121    break;
     122  case 'a':
     123    alpha -= 1;
     124    break;
     125  case 'd':
     126    alpha += 1;
     127    break;
     128
     129    /* game controls */
    109130
    110131  case 'p':
     
    131152void Orxonox::quitGame()
    132153{
    133   glutSetKeyRepeat(GLUT_KEY_REPEAT_DEFAULT); /*do not remove or you will have
    134                                           no repeating keys anymore...*/
     154  //glutIgnoreKeyRepeat(0);                 /* for win32 */
     155  //glutSetKeyRepeat(GLUT_KEY_REPEAT_DEFAULT); /*do not remove or you will have
     156  //                                      no repeating keys anymore...*/
    135157  cout << "finished garbage colletion, quitting..." << endl;
    136158  exit(0);
     
    165187{
    166188  switch(key) {
     189
     190    /* spacecraft controls */
     191   
    167192  case GLUT_KEY_UP:
    168193    upWeGo = true;
     
    184209{
    185210  glClear(GL_COLOR_BUFFER_BIT);
     211
     212  glColor3f(0.0, 0.5, 0.6);
     213  glLoadIdentity();
     214  gluLookAt(0.0, -14.0, 15.0, 0.0 + alpha, 0.0 + beta, 0.0, 0.0, 1.0, 0.0);
    186215  (*world).drawWorld();
     216
    187217  glutSwapBuffers();
    188218}
     
    203233  }
    204234  /* request repaint */
     235
     236  //cout << "contiousRedraw" << endl;
    205237  glutPostRedisplay();
    206238}
     
    212244  glMatrixMode(GL_PROJECTION);
    213245  glLoadIdentity();
    214   glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0);
     246  //glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0); pb: //simple and working
     247  glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 200.0);
     248  //glFrustum(-10.0, 10.0, -5.0, 10.0, 0.0, 100.0);
    215249  glMatrixMode(GL_MODELVIEW);
    216250  glLoadIdentity(); //pb why a second time?
     
    220254void Orxonox::testTheShit()
    221255{
    222   Player* pl = new Player;
    223   (*pl).setPosition(1, 1, 1);
    224   (*world).addPlayer(pl);
     256  //Player* pl = new Player;
     257  //(*pl).setPosition(1, 1, 1);
     258  //(*world).addPlayer(pl);
    225259 
    226260  //NPC* nl = new NPC;
Note: See TracChangeset for help on using the changeset viewer.