Project

General

Profile

Feature #747 ยป 0017-sdl3-Stop-using-renderer-selection-flags.patch

Marko Lindqvist, 07/02/2024 07:35 PM

View differences:

client/gui-sdl3/graphics.c
**************************************************************************/
bool create_surfaces(int width, int height)
{
unsigned flags;
free_surfaces();
main_surface = SDL_CreateSurface(width, height, SDL_PIXELFORMAT_RGBA8888);
......
return FALSE;
}
if (GUI_SDL_OPTION(swrenderer)
|| (sdl3_client_flags & CF_SWRENDERER)) {
flags = SDL_RENDERER_SOFTWARE;
} else {
flags = SDL_RENDERER_ACCELERATED;
}
main_data.renderer = SDL_CreateRenderer(main_data.screen, NULL, flags);
main_data.renderer = SDL_CreateRenderer(main_data.screen, NULL, 0);
if (main_data.renderer == NULL) {
log_fatal(_("Failed to create renderer: %s"), SDL_GetError());
client/gui-sdl3/gui_main.c
_(" -f, --fullscreen\tStart Client in Fullscreen mode\n"));
fc_fprintf(stderr,
_(" -F, --Font SIZE\tUse SIZE as the base font size\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. */
......
return FALSE;
} else if (is_option("--fullscreen", argv[i])) {
GUI_SDL_OPTION(fullscreen) = TRUE;
} else if (is_option("--swrenderer", argv[i])) {
sdl3_client_flags |= CF_SWRENDERER;
} else if ((option = get_option_malloc("--Font", argv, &i, argc, FALSE))) {
if (!str_to_uint(option, &font_size_parameter)) {
fc_fprintf(stderr, _("Invalid font size %s"), option);
......
/* Default theme name is never migrated */
MIGRATE_OPTION(fullscreen);
MIGRATE_OPTION(screen);
MIGRATE_OPTION(swrenderer);
MIGRATE_OPTION(do_cursor_animation);
MIGRATE_OPTION(use_color_cursors);
MIGRATE_STR_OPTION(font_city_names);
client/gui-sdl3/gui_main.h
#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 */
client/options.c
.gui_sdl3_default_theme_name = FC_SDL2_DEFAULT_THEME_NAME,
.gui_sdl3_fullscreen = FALSE,
.gui_sdl3_screen = VIDEO_MODE(640, 480),
.gui_sdl3_swrenderer = FALSE,
.gui_sdl3_do_cursor_animation = TRUE,
.gui_sdl3_use_color_cursors = TRUE,
.gui_sdl3_font_city_names = "10",
......
N_("This option controls the resolution of the "
"selected screen."),
COC_INTERFACE, GUI_SDL3, 640, 480, NULL),
GEN_BOOL_OPTION(gui_sdl3_swrenderer, N_("Use software rendering"),
N_("Usually hardware rendering is used when possible. "
"With this option set, software rendering is always used."),
COC_GRAPHICS, GUI_SDL3, FALSE, NULL),
GEN_BOOL_OPTION(gui_sdl3_do_cursor_animation, N_("Do cursor animation"),
N_("If this option is disabled, the cursor will "
"always be displayed as static."),
client/options.h
char gui_sdl3_default_theme_name[512];
bool gui_sdl3_fullscreen;
struct video_mode gui_sdl3_screen;
bool gui_sdl3_swrenderer;
bool gui_sdl3_do_cursor_animation;
bool gui_sdl3_use_color_cursors;
char gui_sdl3_font_city_names[64];
    (1-1/1)