aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authortaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-24 11:09:15 +0000
committertaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-24 11:09:15 +0000
commit203b28b30acacff3fc8eafe9f43861779344d6e4 (patch)
treeeb960071fa8cbd5bda5559b6598d4f1b25e76736 /src/main.c
parentbaa565c5bce6629ca1fddd95693c02777f6aa1cb (diff)
Add 'no-framerate-limit' and 'status-line' command line options
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@161 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/main.c b/src/main.c
index 3f97c64..2c1459e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -59,6 +59,8 @@ int main(int argc, char *argv[]) {
gameopts.audio_debug = 0;
gameopts.game_debug = 0;
gameopts.no_music = 0;
+ gameopts.no_framerate_limit = 0;
+ gameopts.status_line = 0;
const struct option longopts[] = { {"fullscreen", 0, NULL, 'f'},
{"resolution", 1, NULL, 'r'},
@@ -69,6 +71,8 @@ int main(int argc, char *argv[]) {
{"disable-shaders", 0, &gameopts.disable_shaders, 1},
{"audio-debug", 0, &gameopts.audio_debug, 1},
{"game-debug", 0, &gameopts.game_debug, 1},
+ {"no-framerate-limit", 0, &gameopts.no_framerate_limit, 1},
+ {"status-line", 0, &gameopts.status_line, 1},
{"no-music", 0, NULL, 'n'},
{0, 0, NULL, 0} };
@@ -114,18 +118,20 @@ int main(int argc, char *argv[]) {
case 'h' : {
printf("Syntax: %s [options]\n\n", argv[0]);
printf("Post-apocalyptic Jet Set Willy, set in a 3D nuclear power station.\n\n");
- printf(" -h, --help Display this help message and exit.\n");
- printf(" -v, --version Display version number and exit.\n");
- printf(" -r, --resolution <res> Set display resolution. "
- "See below for possible values for <res>.\n");
- printf(" -f, --fullscreen Use the full screen.\n");
- printf(" -n, --no-music Don't play any background music.\n");
+ printf(" -h, --help Display this help message and exit.\n");
+ printf(" -v, --version Display version number and exit.\n");
+ printf(" -r, --resolution <res> Set display resolution. "
+ "See below for possible values for <res>.\n");
+ printf(" -f, --fullscreen Use the full screen.\n");
+ printf(" -n, --no-music Don't play any background music.\n");
printf("\nAdvanced options:\n\n");
- printf(" --disable-vbos Disable the use of vertex buffer objects.\n");
- printf(" --disable-fbos Disable the use of framebuffer objects.\n");
- printf(" --disable-shaders Disable the use of shaders.\n");
- printf(" --audio-debug Print audio debugging messages to stdout.\n");
- printf(" --game-debug Print game control debugging messages to stdout.\n");
+ printf(" --disable-vbos Disable the use of vertex buffer objects.\n");
+ printf(" --disable-fbos Disable the use of framebuffer objects.\n");
+ printf(" --disable-shaders Disable the use of shaders.\n");
+ printf(" --audio-debug Print audio debugging messages to stdout.\n");
+ printf(" --game-debug Print game control debugging messages to stdout.\n");
+ printf(" --no-framerate-limit Do not wait between frames.\n");
+ printf(" --status-line Show game status on the terminal.\n");
printf("\n");
printf("Allowable values for <res> are as follows:\n\n");
printf("<res> Width Height\n");
@@ -233,11 +239,13 @@ int main(int argc, char *argv[]) {
render_draw(game, t);
}
- //printf("%+7.4f %+7.4f %+7.4f %+5.1f deg %+7.5f %+7.5f %+7.5f %2i %2i %2i %3i fps\r",
- // game->lander->x, game->lander->y, game->lander->z,
- // rad2deg(game->lander->yaw), game->lander->vx, game->lander->vy, game->lander->vz,
- // game->cur_room_x, game->cur_room_y, game->cur_room_z, game->fps);
- //fflush(stdout);
+ if ( gameopts.status_line ) {
+ printf("%+7.4f %+7.4f %+7.4f %+5.1f deg %+7.5f %+7.5f %+7.5f %2i %2i %2i %3i fps\r",
+ game->lander->x, game->lander->y, game->lander->z,
+ rad2deg(game->lander->yaw), game->lander->vx, game->lander->vy, game->lander->vz,
+ game->cur_room_x, game->cur_room_y, game->cur_room_z, game->fps);
+ fflush(stdout);
+ }
/* Calculate FPS every half a second */
game->frames++;
@@ -251,7 +259,7 @@ int main(int argc, char *argv[]) {
* This is a fudge - ideally this delay would adapt so that the CPU is not hogged when the GPU is the
* limiting factor, and be zero when the CPU is limiting. I don't know of a sensible way to tell which
* is the case. */
- usleep(25000);
+ if ( !gameopts.no_framerate_limit ) usleep(25000);
}