From 6b3a35ac51831026850619653b99fce230b2d83d Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 3 Feb 2023 20:11:56 +0200 Subject: [PATCH 05/14] sdl2: Add command line option -- --swrenderer See osdn #47300 Signed-off-by: Marko Lindqvist --- client/gui-sdl2/graphics.c | 3 ++- client/gui-sdl2/gui_main.c | 5 ++++- client/gui-sdl2/gui_main.h | 7 ++++--- doc/man/freeciv-client.6.in | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/client/gui-sdl2/graphics.c b/client/gui-sdl2/graphics.c index da2ea05181..28132824b5 100644 --- a/client/gui-sdl2/graphics.c +++ b/client/gui-sdl2/graphics.c @@ -597,7 +597,8 @@ bool set_video_mode(int width, int height, int flags_in) return FALSE; } - if (gui_options.gui_sdl2_swrenderer) { + if (gui_options.gui_sdl2_swrenderer + || (SDL_Client_Flags & CF_SWRENDERER)) { flags = SDL_RENDERER_SOFTWARE; } else { flags = 0; diff --git a/client/gui-sdl2/gui_main.c b/client/gui-sdl2/gui_main.c index ef21e5040c..f040b3f517 100644 --- a/client/gui-sdl2/gui_main.c +++ b/client/gui-sdl2/gui_main.c @@ -164,9 +164,10 @@ struct callback_list *callbacks = NULL; **************************************************************************/ static void print_usage(void) { - /* add client-specific usage information here */ + /* Add client-specific usage information here */ fc_fprintf(stderr, _(" -f, --fullscreen\tStart Client in Fullscreen mode\n")); + fc_fprintf(stderr, _(" -s, --swrenderer\tUse SW renderer\n")); fc_fprintf(stderr, _(" -t, --theme THEME\tUse GUI theme THEME\n")); /* TRANS: No full stop after the URL, could cause confusion. */ @@ -187,6 +188,8 @@ static void parse_options(int argc, char **argv) exit(EXIT_SUCCESS); } else if (is_option("--fullscreen", argv[i])) { gui_options.gui_sdl2_fullscreen = TRUE; + } else if (is_option("--swrenderer", argv[i])) { + SDL_Client_Flags |= CF_SWRENDERER; } else if ((option = get_option_malloc("--theme", argv, &i, argc, FALSE))) { sz_strlcpy(gui_options.gui_sdl2_default_theme_name, option); free(option); diff --git a/client/gui-sdl2/gui_main.h b/client/gui-sdl2/gui_main.h index bf3a28e984..bc57e3bc25 100644 --- a/client/gui-sdl2/gui_main.h +++ b/client/gui-sdl2/gui_main.h @@ -55,10 +55,11 @@ #define CF_DRAW_PLAYERS_PEACE_STATUS (1<<21) #define CF_DRAW_PLAYERS_ALLIANCE_STATUS (1<<22) #define CF_DRAW_PLAYERS_NEUTRAL_STATUS (1<<23) +#define CF_SWRENDERER (1<<24) -/* mouse button behavior */ -#define MB_MEDIUM_HOLD_DELAY 500 /* medium hold: 500ms */ -#define MB_LONG_HOLD_DELAY 2000 /* long hold: 2000ms */ +/* Mouse button behavior */ +#define MB_MEDIUM_HOLD_DELAY 500 /* Medium hold: 500ms */ +#define MB_LONG_HOLD_DELAY 2000 /* Long hold: 2000ms */ /* Predicate for detecting basic widget activation events. */ #define PRESSED_EVENT(event) ( \ diff --git a/doc/man/freeciv-client.6.in b/doc/man/freeciv-client.6.in index f4a6636f0e..8653cc694c 100644 --- a/doc/man/freeciv-client.6.in +++ b/doc/man/freeciv-client.6.in @@ -60,6 +60,7 @@ documentation. It also accepts accepts the following parameters following \fB\-\-\fP: .B [ \-f|\-\-fullscreen ] \ [ \-h|\-\-help ] \ +[ \-s|\-\-swrenderer ] \ [ \-t|\-\-theme \fIstring\fP ] .SH DESCRIPTION -- 2.39.1