Esempio n. 1
0
void fs_ml_toggle_fullscreen() {
    fs_log("fs_ml_toggle_fullscreen\n");
#ifdef USE_SDL2
    if (g_fs_emu_video_fullscreen_mode == FULLSCREEN_WINDOW) {
        fs_emu_warning("Cannot toggle fullscreen with fullscreen-mode=window");
        return;
    }

    int display_index = 0;
    SDL_DisplayMode mode;
    memset(&mode, 0, sizeof(SDL_DisplayMode));
    if (SDL_GetDesktopDisplayMode(display_index, &mode) == 0) {
        SDL_SetWindowDisplayMode(g_fs_ml_window, &mode);
    }

    g_fs_emu_video_fullscreen = !g_fs_emu_video_fullscreen;
    int flags = 0;
    if (g_fs_emu_video_fullscreen) {
        if (g_fs_emu_video_fullscreen_mode == FULLSCREEN_DESKTOP) {
            flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
        }
        else {
            flags = SDL_WINDOW_FULLSCREEN;
        }
    }
    SDL_SetWindowFullscreen(g_fs_ml_window, flags);

#else
    g_fs_emu_video_fullscreen = !g_fs_emu_video_fullscreen;
    destroy_opengl_state();
    set_video_mode();
    recreate_opengl_state();
#endif
}
Esempio n. 2
0
static void on_resize(int width, int height) {
    if (width == g_fs_ml_video_width && height == g_fs_ml_video_height) {
        fs_log("got resize event, but size was unchanged\n");
        return;
    }
    if (g_fs_emu_video_fullscreen) {
        fs_log("not updating window size in fullscreen\n");
    }
    else if (width == g_fullscreen_width &&
        height == g_fullscreen_height) {
        fs_log("not setting window size to fullscreen size\n");
    }
    else {
        g_window_width = width;
        g_window_height = height;
        fs_log("resize event %d %d\n", width, height);
    }
#ifdef USE_SDL2
    g_fs_ml_video_width = width;
    g_fs_ml_video_height = height;
#else
#ifdef MACOSX
        destroy_opengl_state();
#endif
        set_video_mode();
#ifdef MACOSX
        recreate_opengl_state();
#endif
#endif
}
Esempio n. 3
0
void fs_ml_toggle_fullscreen() {
	g_fs_emu_video_fullscreen = !g_fs_emu_video_fullscreen;

	destroy_opengl_state();
	set_video_mode();
	recreate_opengl_state();
}