Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
May 23, 2004, 11:21:38 PM (21 years ago)
Author:
patrick
Message:

orxonox/trunk: hardware independant game speed, more shoots, more speed - see mail

File:
1 edited

Legend:

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

    r1899 r1900  
    5151Player* Orxonox::localPlayer = 0;
    5252bool Orxonox::pause = false;
     53bool Orxonox::inputEnabled = false;
    5354bool Orxonox::upWeGo = false;
    5455bool Orxonox::downWeGo = false;
     
    8788
    8889  glutTimerFunc(1000, timeSlice, 0);
     90  cout << "measuring performance...";
    8991}
    9092
     
    114116  world->addNPC(npc);
    115117
     118  NPC* npc2 = new NPC;
     119  npc2->setPosition(-2.0, 10.0, 3.0);
     120  npc2->setCollisionRadius(1.0);
     121  world->addNPC(npc2);
     122
    116123  glutSpecialFunc(specFunc);
    117124  glutSpecialUpFunc(releaseKey);
     
    126133void Orxonox::timeSlice(int value)
    127134{
    128   cout << "fps: " << fps << endl;
     135  cout << "got " << fps << endl;
     136  /* this is very very unsafe: io could be uninit */
     137  io->setPlayerStep(19.2 / fps); /* set player to propper speed */
     138  //localPlayer->shootLaser->setShootStep(fps/48.0); /* set shoot speed */
    129139  fps = 0;
     140  inputEnabled = true;
    130141  glutTimerFunc(1000, timeSlice, 0);
    131142}
     
    259270
    260271  /* check for input to pass it over */
    261   if ( !pause && (rightWeGo || leftWeGo || upWeGo || downWeGo || shoot1)) {
    262     if (upWeGo)
    263       (*io).goUp();
    264     if (downWeGo)
     272  if ( !pause && inputEnabled &&
     273       (rightWeGo || leftWeGo || upWeGo || downWeGo || shoot1))
     274    {
     275      if (upWeGo)
     276        (*io).goUp();
     277      if (downWeGo)
    265278      (*io).goDown();
    266     if (rightWeGo)
    267       (*io).goRight();
    268     if (leftWeGo)
     279      if (rightWeGo)
     280        (*io).goRight();
     281      if (leftWeGo)
    269282      (*io).goLeft();
    270     if (shoot1)
    271       (*io).shoot();
    272   }
     283      if (shoot1)
     284        (*io).shoot();
     285    }
    273286  /* request repaint */
    274287  glutPostRedisplay();
Note: See TracChangeset for help on using the changeset viewer.