mspraggs / potentia

Southampton Game Jam 2015
0 stars 0 forks source link

Command line options #79

Closed mspraggs closed 9 years ago

mspraggs commented 9 years ago

So we could implement options for window size and whether it's fullscreen or not. It's very easy to do this in a very basic way, so long as all arguments are positional (meaning they're passed in a specific order). For a more advanced interface with flags and so on it may be useful to have some sort of ArgParser class or something. Alternatively, there is almost certainly a library that does this already, and we could save ourselves some time and just use one of those.

Fyll commented 9 years ago

To get us through until we decide to look at this properly, I've written in a quick FULLSCREEN and a SOUNDOFF option for the command line, to sate my want for a lack of audio and David's want for fullscreen. It's just in main.cpp if you want to add any more.

mspraggs commented 9 years ago

Awww... but I just did this... Merge conflict here we come...

Fyll commented 9 years ago

Mwa ha ha ha! The fastest programmer wins! >:D

mspraggs commented 9 years ago

Yep, but your use of global variables meant somewhere a kitten died :-P

Fyll commented 9 years ago

I'm sure he had it coming.

How have you done it without global variables?

mspraggs commented 9 years ago

I added enable and disable member functions to Sound, then passed a bool into the Game constructor.

Fyll commented 9 years ago

Fair enough. I was basically trying to keep things as constants, so left them as global variables. I'm sure at some point in the code we'll have to use a global flag for this sort of thing though...

mspraggs commented 9 years ago

How do you mean?

Ok this is done. I cheated and used a separate library/header: ezOptionParser. It's a single header file, so I've just added it to the repo.

Usage:

./game -ns // Turn off sound (or use --no-sound)
./game -g 800x600 // Change screen geometry (or use --geometry 800x600)
./game -f // Display full screen (or use --fullscreen)
./game -h // Display help (or --help)

One thing that doesn't work is propagation of screen width/height through to tile sizing, so everything just comes out bigger when the screen size is adjusted. I will work on a fix for this.