aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorThomas White <weiss@jade.(none)>2008-08-13 12:40:53 +0100
committerThomas White <weiss@jade.(none)>2008-08-13 12:40:53 +0100
commit877a8718f419efe6bfef4ba248741c1233e22a1d (patch)
tree525e9329ab75107c1542b4d51034e4553ebef325 /src/main.c
parentc5844067aa6dea33ee7be800c8ab51baf1121848 (diff)
Increase resolution of game timer
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 5bc4886..2624485 100644
--- a/src/main.c
+++ b/src/main.c
@@ -213,17 +213,19 @@ int main(int argc, char *argv[]) {
/* Main loop */
finished = 0;
game->time = 0.0;
- game->tlast = SDL_GetTicks();
+ game->tlast = utils_highresms();
+ game->t_fps = game->tlast;
while ( !finished ) {
int mx, my;
Uint8 buttons;
int mouse_thrust = 0;
- int dt;
+ double us, dt;
/* Tick size is measured, ... */
- dt = SDL_GetTicks() - game->tlast;
- game->tlast = SDL_GetTicks();
+ us = utils_highresms();
+ dt = us - game->tlast;
+ game->tlast = us;
/* ... but timer advances only when game is not paused */
if ( !game->paused ) {
game->time += dt;
@@ -280,7 +282,7 @@ int main(int argc, char *argv[]) {
if ( mouse_thrust ) game->thrusting = 0;
if ( gameopts.status_line ) {
- printf("%10lli %4i %+7.5f %+7.5f %+7.5f %2i %2i %2i %3i fps (r:%6lli p:%6lli) \r",
+ printf("%+13.3f %+5.3f %+7.5f %+7.5f %+7.5f %2i %2i %2i %3i fps (r:%6lli p:%6lli) \r",
game->time, dt,
game->lander->vx, game->lander->vy, game->lander->vz,
game->cur_room_x, game->cur_room_y, game->cur_room_z, game->fps,