Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2940 in orxonox.OLD for orxonox/trunk/importer/framework.cc


Ignore:
Timestamp:
Nov 21, 2004, 1:52:34 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk/importer: implemented framerate (very cheap), now it should run in the same speed on any platform.

File:
1 edited

Legend:

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

    r2939 r2940  
    55void DrawGLScene()
    66{
    7   dist -= (dist-zoomTo)/100;
     7  currFrame = SDL_GetTicks();
     8  dt = currFrame - lastFrame;
     9  if (dt == 0)
     10    dist += (zoomTo-dist)/500;
     11  else
     12    dist += (zoomTo-dist)/500 *(float)dt;
    813
    9   rotatorP += rotatorV;
     14  rotatorP += rotatorV *(float)dt;
    1015 
    1116  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
     
    2025
    2126  SDL_GL_SwapBuffers(); // Swap the buffers
     27  lastFrame = currFrame;
    2228}
    2329
     
    96102          {
    97103            printf("MouseWheel down\n");
    98             zoomTo *= 2;
     104            zoomTo *= 2.0;
    99105          }
    100106        else
Note: See TracChangeset for help on using the changeset viewer.