Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Toggle Cpp openGL with F12 #3230

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions game/graphics/pipelines/opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,18 @@ GLDisplay::GLDisplay(SDL_Window* window, SDL_GLContext gl_context, bool is_main)
m_input_manager->register_command(
CommandBinding::Source::KEYBOARD,
CommandBinding(SDLK_F2, [&]() { m_take_screenshot_next_frame = true; }));
m_input_manager->register_command(
CommandBinding::Source::KEYBOARD,
CommandBinding(Gfx::g_debug_settings.toggle_fullscreen_key, [&]() {
if (Display::GetMainDisplay()->get_display_manager()->get_window_display_mode() ==
WindowDisplayMode::Fullscreen) {
Display::GetMainDisplay()->get_display_manager()->enqueue_set_window_display_mode(
WindowDisplayMode::Windowed);
} else {
Display::GetMainDisplay()->get_display_manager()->enqueue_set_window_display_mode(
WindowDisplayMode::Fullscreen);
}
}));
}

GLDisplay::~GLDisplay() {
Expand Down
2 changes: 2 additions & 0 deletions game/settings/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ void to_json(json& j, const DebugSettings& obj) {
json_serialize(text_check_range);
json_serialize(text_max_range);
json_serialize(hide_imgui_key);
json_serialize(toggle_fullscreen_key);
}

void from_json(const json& j, DebugSettings& obj) {
Expand All @@ -31,6 +32,7 @@ void from_json(const json& j, DebugSettings& obj) {
json_deserialize_if_exists(text_check_range);
json_deserialize_if_exists(text_max_range);
json_deserialize_if_exists(hide_imgui_key);
json_deserialize_if_exists(toggle_fullscreen_key);
}

DebugSettings::DebugSettings() {
Expand Down
1 change: 1 addition & 0 deletions game/settings/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct DebugSettings {
bool text_check_range = false;
float text_max_range = 0;
u32 hide_imgui_key = SDLK_LALT;
u32 toggle_fullscreen_key = SDLK_F12;

void save_settings();
};
Expand Down