mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
support a command line switch "--debug" (or "-d") to enable debug mode
This commit is contained in:
parent
6d7007b39e
commit
a309b8cb2b
1 changed files with 19 additions and 3 deletions
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "internal.h"
|
||||
#include <dlfcn.h>
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
#include <locale.h>
|
||||
#include <unistd.h>
|
||||
|
@ -52,6 +53,9 @@ static char* GetDefaultWindowHeight(struct Game* game) {
|
|||
SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char* name, struct Params params) {
|
||||
struct Game* game = calloc(1, sizeof(struct Game));
|
||||
|
||||
game->_priv.argc = argc;
|
||||
game->_priv.argv = argv;
|
||||
|
||||
game->_priv.name = strdup(name);
|
||||
game->_priv.params = params;
|
||||
|
||||
|
@ -126,6 +130,21 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
|
|||
game->config.fullscreen = false; // we can't start fullscreen on emscripten
|
||||
#endif
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"debug", no_argument, NULL, 'd'},
|
||||
{NULL, 0, NULL, 0},
|
||||
};
|
||||
|
||||
char opt;
|
||||
while ((opt = getopt_long(argc, argv, "d", long_options, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
game->config.debug.enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
game->_priv.showconsole = game->config.debug.enabled;
|
||||
game->_priv.showtimeline = false;
|
||||
|
||||
|
@ -320,9 +339,6 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
|
|||
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
game->_priv.argc = argc;
|
||||
game->_priv.argv = argv;
|
||||
|
||||
game->data = NULL;
|
||||
|
||||
game->_priv.shutting_down = false;
|
||||
|
|
Loading…
Reference in a new issue