options.identifier = NULL;
options.level_nr = NULL;
+ options.display_nr = 0;
+
options.mytapes = FALSE;
options.serveronly = FALSE;
options.network = FALSE;
if (option_arg == next_option)
options_left++;
}
+ else if (strncmp(option, "-display", option_len) == 0)
+ {
+ if (option_arg == NULL)
+ FailWithHelp("option '%s' requires an argument", option_str);
+
+ if (option_arg == next_option)
+ options_left++;
+
+ int display_nr = atoi(option_arg);
+
+ options.display_nr =
+ MAX(0, MIN(display_nr, SDL_GetNumVideoDisplays() - 1));
+
+ if (display_nr != options.display_nr)
+ Warn("invalid display %d -- using display %d",
+ display_nr, options.display_nr);
+ }
#if defined(PLATFORM_MAC)
else if (strPrefix(option, "-psn"))
{
int screen_height = video.screen_height;
int surface_flags = (fullscreen ? surface_flags_fullscreen :
surface_flags_window);
+ int display_nr = options.display_nr;
// default window size is unscaled
video.window_width = screen_width;
if (sdl_window == NULL)
sdl_window = SDL_CreateWindow(program.window_title,
- SDL_WINDOWPOS_CENTERED,
- SDL_WINDOWPOS_CENTERED,
+ SDL_WINDOWPOS_CENTERED_DISPLAY(display_nr),
+ SDL_WINDOWPOS_CENTERED_DISPLAY(display_nr),
video.window_width,
video.window_height,
surface_flags);
{
SDLSetWindowScaling(setup.window_scaling_percent);
SDL_SetWindowPosition(sdl_window,
- SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
+ SDL_WINDOWPOS_CENTERED_DISPLAY(options.display_nr),
+ SDL_WINDOWPOS_CENTERED_DISPLAY(options.display_nr));
video.fullscreen_initial = FALSE;
}
char *identifier;
char *level_nr;
+ int display_nr;
+
boolean mytapes;
boolean serveronly;
boolean network;
" -g, --graphics DIRECTORY alternative graphics DIRECTORY\n"
" -s, --sounds DIRECTORY alternative sounds DIRECTORY\n"
" -m, --music DIRECTORY alternative music DIRECTORY\n"
+ " --display NR open program window on display NR\n"
" --mytapes use private tapes for tape tests\n"
" -n, --network network multiplayer game\n"
" --serveronly only start network server\n"