From eb67624c218838fe895824ba5985797c591dab16 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 3 Feb 2023 20:11:56 +0200 Subject: [PATCH 20/20] 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 168049c183..b5195eaecd 100644 --- a/client/gui-sdl2/graphics.c +++ b/client/gui-sdl2/graphics.c @@ -599,7 +599,8 @@ bool set_video_mode(unsigned width, unsigned height, unsigned flags_in) return FALSE; } - if (gui_options.gui_sdl2_swrenderer) { + if (gui_options.gui_sdl2_swrenderer + || (sdl2_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 bc718e6103..676095eef7 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])) { + sdl2_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 becde61b7b..c5b41f5342 100644 --- a/client/gui-sdl2/gui_main.h +++ b/client/gui-sdl2/gui_main.h @@ -56,10 +56,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 c9d5497fcc..9c9098486f 100644 --- a/doc/man/freeciv-client.6.in +++ b/doc/man/freeciv-client.6.in @@ -53,6 +53,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