mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp.git
synced 2024-12-29 09:23:53 +00:00
Add Linux fullscreen support (#8)
Temporary workaround for RT64 not supporting full screen in Linux
This commit is contained in:
parent
25a3837b37
commit
dd1315e6eb
@ -111,6 +111,11 @@ ultramodern::WindowHandle create_window(ultramodern::gfx_callbacks_t::gfx_data_t
|
||||
window = SDL_CreateWindow("Zelda 64: Recompiled", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1600, 960, SDL_WINDOW_RESIZABLE );
|
||||
#if defined(__linux__)
|
||||
SetImageAsIcon("icons/512.png",window);
|
||||
if (ultramodern::get_graphics_config().wm_option == ultramodern::WindowMode::Fullscreen) { // TODO: Remove once RT64 gets native fullscreen support on Linux
|
||||
SDL_SetWindowFullscreen(window,SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
} else {
|
||||
SDL_SetWindowFullscreen(window,0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (window == nullptr) {
|
||||
|
@ -200,6 +200,23 @@ void close_config_menu_impl() {
|
||||
recomp::set_current_menu(recomp::Menu::Launcher);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Remove once RT64 gets native fullscreen support on Linux
|
||||
#if defined(__linux__)
|
||||
extern SDL_Window* window;
|
||||
#endif
|
||||
|
||||
void apply_graphics_config(void) {
|
||||
ultramodern::set_graphics_config(new_options);
|
||||
#if defined(__linux__) // TODO: Remove once RT64 gets native fullscreen support on Linux
|
||||
if (new_options.wm_option == ultramodern::WindowMode::Fullscreen) {
|
||||
SDL_SetWindowFullscreen(window,SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
} else {
|
||||
SDL_SetWindowFullscreen(window,0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void close_config_menu() {
|
||||
if (ultramodern::get_graphics_config() != new_options) {
|
||||
prompt_context.open_prompt(
|
||||
@ -208,7 +225,7 @@ void close_config_menu() {
|
||||
"Apply",
|
||||
"Discard",
|
||||
[]() {
|
||||
ultramodern::set_graphics_config(new_options);
|
||||
apply_graphics_config();
|
||||
graphics_model_handle.DirtyAllVariables();
|
||||
close_config_menu_impl();
|
||||
},
|
||||
@ -405,7 +422,7 @@ public:
|
||||
recomp::register_event(listener, "apply_options",
|
||||
[](const std::string& param, Rml::Event& event) {
|
||||
graphics_model_handle.DirtyVariable("options_changed");
|
||||
ultramodern::set_graphics_config(new_options);
|
||||
apply_graphics_config();
|
||||
});
|
||||
recomp::register_event(listener, "config_keydown",
|
||||
[](const std::string& param, Rml::Event& event) {
|
||||
@ -878,6 +895,6 @@ void recomp::update_supported_options() {
|
||||
|
||||
void recomp::toggle_fullscreen() {
|
||||
new_options.wm_option = (new_options.wm_option == ultramodern::WindowMode::Windowed) ? ultramodern::WindowMode::Fullscreen : ultramodern::WindowMode::Windowed;
|
||||
ultramodern::set_graphics_config(new_options);
|
||||
apply_graphics_config();
|
||||
graphics_model_handle.DirtyVariable("wm_option");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user