Changeset 617


Ignore:
Timestamp:
Feb 9, 2011, 12:23:54 AM (10 years ago)
Author:
sam
Message:

Store the requested FPS in the Ticker class.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/deushax/deushax.cpp

    r616 r617  
    5050    //SDL_WM_GrabInput(SDL_GRAB_ON);
    5151
     52    Ticker::Setup(FPS);
     53
    5254    /* Initialise OpenGL */
    5355    Video::Setup(video->w, video->h);
     
    7678        Ticker::TickDraw();
    7779        SDL_GL_SwapBuffers();
    78         Ticker::ClampFps(1000.0f / FPS);
     80        Ticker::ClampFps();
    7981    }
    8082
  • trunk/deushax/gtk/glmapview.cpp

    r616 r617  
    122122    gtk_widget_grab_focus(glarea);
    123123    if (gtk_gl_area_make_current(GTK_GL_AREA(glarea)))
     124    {
     125        Ticker::Setup(FPS);
    124126        Video::Setup(glarea->allocation.width, glarea->allocation.height);
     127    }
    125128
    126129    UpdateAdjustments();
     
    156159
    157160        // FIXME: do some GTK stuff in here
    158         Ticker::ClampFps(1000.0f / FPS);
     161        Ticker::ClampFps();
    159162    }
    160163
  • trunk/monsterz/monsterz.cpp

    r616 r617  
    5252    SDL_ShowCursor(0);
    5353
    54     /* Initialise OpenGL */
     54    /* Initialise everything */
     55    Ticker::Setup(FPS);
    5556    Video::Setup(video->w, video->h);
    5657    Audio::Setup(2);
     
    7576        Ticker::TickDraw();
    7677        SDL_GL_SwapBuffers();
    77         Ticker::ClampFps(1000.0f / FPS);
     78        Ticker::ClampFps();
    7879    }
    7980
  • trunk/src/ticker.cpp

    r616 r617  
    140140}
    141141
     142void Ticker::Setup(float fps)
     143{
     144    data->fps = fps;
     145}
     146
    142147void Ticker::TickGame()
    143148{
     
    309314}
    310315
    311 void Ticker::ClampFps(float deltams)
     316void Ticker::ClampFps()
    312317{
    313318    Profiler::Stop(Profiler::STAT_TICK_BLIT);
     319
     320    float deltams = data->fps ? 1000.0f / data->fps : 0.0f;
    314321
    315322    if (deltams > data->bias + 200.0f)
  • trunk/src/ticker.h

    r221 r617  
    2929    static int Unref(Entity *entity);
    3030
     31    static void Setup(float fps);
    3132    static void TickGame();
    3233    static void TickDraw();
    33     static void ClampFps(float deltams);
     34    static void ClampFps();
    3435    static int GetFrameNum();
    3536
Note: See TracChangeset for help on using the changeset viewer.