Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 20, 2004, 1:01:57 AM (21 years ago)
Author:
patrick
Message:

orxonox/trunk: added ability to shoot. so check out the new release and shoot the fuck up

File:
1 edited

Legend:

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

    r1883 r1896  
    2626/* class definition header */
    2727#include "orxonox.h"
    28 #include "environment.h"
    2928
    3029
     
    5049World* Orxonox::world = 0;
    5150InputOutput* Orxonox::io = 0;
     51Player* Orxonox::localPlayer = 0;
    5252bool Orxonox::pause = false;
    5353bool Orxonox::upWeGo = false;
     
    5555bool Orxonox::rightWeGo = false;
    5656bool Orxonox::leftWeGo = false;
     57bool Orxonox::shoot1 = false;
    5758int Orxonox::alpha = 0;
    5859int Orxonox::beta = 0;
     
    8283  glutReshapeFunc(reshape);
    8384  glutKeyboardFunc(keyboard);
     85  glutKeyboardUpFunc(upKeyboard);
    8486}
    8587
     
    9698  world = new World;
    9799  (*world).initEnvironement();
    98   Player* localPlayer = new Player;
     100  localPlayer = new Player;
    99101  io = new InputOutput(world, localPlayer);
    100102  (*world).addPlayer(localPlayer);
    101103  Environment *env = new Environment;
    102104  (*world).addEnv(env);
    103  
    104105
    105106  glutSpecialFunc(specFunc);
    106107  glutSpecialUpFunc(releaseKey);
    107108
    108   //for testing purps only
    109   //testTheShit();
    110109  glutIdleFunc(continousRedraw);
     110  //cout << "Orxonox::gameInit" << endl;
    111111}
    112112
     
    131131
    132132    /* game controls */
    133 
    134133  case 'p':
    135134    if (pause)
     
    146145      }
    147146    break;
     147  case 32:
     148    shoot1 = true;
     149    break;
    148150  case 27:
    149151  case 'q':
     
    154156
    155157
     158void Orxonox::upKeyboard(unsigned char key, int x, int y)
     159{
     160  switch(key) {
     161  case 32:
     162    shoot1 = false;
     163    break;
     164  }
     165}
     166
     167
    156168void Orxonox::quitGame()
    157169{
    158   //glutIgnoreKeyRepeat(0);                 /* for win32 */
    159   //glutSetKeyRepeat(GLUT_KEY_REPEAT_DEFAULT); /*do not remove or you will have
    160   //                                      no repeating keys anymore...*/
    161   cout << "finished garbage colletion, quitting..." << endl;
     170  //cout << "finished garbage colletion, quitting..." << endl;
    162171  exit(0);
    163172}
     
    191200{
    192201  switch(key) {
    193 
    194202    /* spacecraft controls */
    195    
    196203  case GLUT_KEY_UP:
    197204    upWeGo = true;
     
    226233{
    227234  /* check for input to pass it over */
    228   if ( !pause && (rightWeGo || leftWeGo || upWeGo || downWeGo)) {
     235  if ( !pause && (rightWeGo || leftWeGo || upWeGo || downWeGo || shoot1)) {
    229236    if (upWeGo)
    230237      (*io).goUp();
     
    235242    if (leftWeGo)
    236243      (*io).goLeft();
     244    if (shoot1)
     245      (*io).shoot();
    237246  }
    238247  /* request repaint */
    239 
    240   //cout << "contiousRedraw" << endl;
    241248  glutPostRedisplay();
     249  //cout << "Orxonox::continousRedraw" << endl;
    242250}
    243251
     
    248256  glMatrixMode(GL_PROJECTION);
    249257  glLoadIdentity();
    250   //glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0); pb: //simple and working
    251258  glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 200.0);
    252   //glFrustum(-10.0, 10.0, -5.0, 10.0, 0.0, 100.0);
    253259  glMatrixMode(GL_MODELVIEW);
    254260  glLoadIdentity(); //pb why a second time?
Note: See TracChangeset for help on using the changeset viewer.