VIDEO: Add API for querying and setting fullscreen mode.

This commit is contained in:
Lars Brinkhoff 2020-07-08 08:28:35 +02:00
parent 9711fc017b
commit d93bfe62de
2 changed files with 28 additions and 0 deletions

View file

@ -1404,6 +1404,20 @@ if (SDL_SemWait (vid_mouse_events.sem) == 0) {
}
}
t_bool vid_is_fullscreen (void)
{
return SDL_GetWindowFlags (vid_window) & SDL_WINDOW_FULLSCREEN_DESKTOP;
}
t_stat vid_set_fullscreen (t_bool flag)
{
if (flag)
SDL_SetWindowFullscreen (vid_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
else
SDL_SetWindowFullscreen (vid_window, 0);
return SCPE_OK;
}
void vid_update (void)
{
SDL_Rect vid_dst;
@ -2368,4 +2382,16 @@ t_stat vid_screenshot (const char *filename)
sim_printf ("video support unavailable\n");
return SCPE_NOFNC|SCPE_NOMESSAGE;
}
t_bool vid_is_fullscreen (void)
{
sim_printf ("video support unavailable\n");
return FALSE;
}
t_stat vid_set_fullscreen (t_bool flag)
{
sim_printf ("video support unavailable\n");
return SCPE_OK;
}
#endif /* defined(USE_SIM_VIDEO) */

View file

@ -198,6 +198,8 @@ t_stat vid_show_release_key (FILE* st, UNIT* uptr, int32 val, CONST void* desc);
t_stat vid_show_video (FILE* st, UNIT* uptr, int32 val, CONST void* desc);
t_stat vid_show (FILE* st, DEVICE *dptr, UNIT* uptr, int32 val, CONST char* desc);
t_stat vid_screenshot (const char *filename);
t_bool vid_is_fullscreen (void);
t_stat vid_set_fullscreen (t_bool flag);
extern t_bool vid_active;
void vid_set_cursor_position (int32 x, int32 y); /* cursor position (set by calling code) */