From 88c01588aa0830e219eaa62588839e4d1e2883ce Mon Sep 17 00:00:00 2001 From: untodesu Date: Wed, 25 Jun 2025 00:44:36 +0500 Subject: Clang-format the entire source code --- game/client/main_menu.cc | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'game/client/main_menu.cc') diff --git a/game/client/main_menu.cc b/game/client/main_menu.cc index b1c9821..55a8021 100644 --- a/game/client/main_menu.cc +++ b/game/client/main_menu.cc @@ -1,4 +1,5 @@ #include "client/pch.hh" + #include "client/main_menu.hh" #include "core/constexpr.hh" @@ -24,7 +25,7 @@ static std::string str_quit; static resource_ptr title; static float title_aspect; -static void on_glfw_key(const GlfwKeyEvent &event) +static void on_glfw_key(const GlfwKeyEvent& event) { if(session::is_ingame() && (event.key == GLFW_KEY_ESCAPE) && (event.action == GLFW_PRESS)) { if(globals::gui_screen == GUI_SCREEN_NONE) { @@ -39,7 +40,7 @@ static void on_glfw_key(const GlfwKeyEvent &event) } } -static void on_language_set(const LanguageSetEvent &event) +static void on_language_set(const LanguageSetEvent& event) { str_play = language::resolve_gui("main_menu.play"); str_resume = language::resolve_gui("main_menu.resume"); @@ -57,9 +58,11 @@ void main_menu::init(void) std::terminate(); } - if(title->size.x > title->size.y) + if(title->size.x > title->size.y) { title_aspect = static_cast(title->size.x) / static_cast(title->size.y); - else title_aspect = static_cast(title->size.y) / static_cast(title->size.x); + } else { + title_aspect = static_cast(title->size.y) / static_cast(title->size.x); + } globals::dispatcher.sink().connect<&on_glfw_key>(); globals::dispatcher.sink().connect<&on_language_set>(); @@ -84,8 +87,7 @@ void main_menu::layout(void) if(session::is_ingame()) { ImGui::Dummy(ImVec2(0.0f, 32.0f * globals::gui_scale)); - } - else { + } else { auto reference_height = 0.225f * window_size.y; auto image_width = cxpr::min(window_size.x, reference_height * title_aspect); auto image_height = image_width / title_aspect; @@ -100,20 +102,28 @@ void main_menu::layout(void) if(session::is_ingame()) { ImGui::SetCursorPosX(button_xpos); - if(ImGui::Button(str_resume.c_str(), ImVec2(button_width, 0.0f))) + + if(ImGui::Button(str_resume.c_str(), ImVec2(button_width, 0.0f))) { globals::gui_screen = GUI_SCREEN_NONE; + } + ImGui::Spacing(); - } - else { + } else { ImGui::SetCursorPosX(button_xpos); - if(ImGui::Button(str_play.c_str(), ImVec2(button_width, 0.0f))) + + if(ImGui::Button(str_play.c_str(), ImVec2(button_width, 0.0f))) { globals::gui_screen = GUI_PLAY_MENU; + } + ImGui::Spacing(); } ImGui::SetCursorPosX(button_xpos); - if(ImGui::Button(str_settings.c_str(), ImVec2(button_width, 0.0f))) + + if(ImGui::Button(str_settings.c_str(), ImVec2(button_width, 0.0f))) { globals::gui_screen = GUI_SETTINGS; + } + ImGui::Spacing(); if(session::is_ingame()) { @@ -126,17 +136,19 @@ void main_menu::layout(void) } ImGui::Spacing(); - } - else { + } else { ImGui::SetCursorPosX(button_xpos); - if(ImGui::Button(str_quit.c_str(), ImVec2(button_width, 0.0f))) + + if(ImGui::Button(str_quit.c_str(), ImVec2(button_width, 0.0f))) { glfwSetWindowShouldClose(globals::window, true); - ImGui::Spacing(); + } + + ImGui::Spacing(); } if(!session::is_ingame()) { - const auto &padding = ImGui::GetStyle().FramePadding; - const auto &spacing = ImGui::GetStyle().ItemSpacing; + const auto& padding = ImGui::GetStyle().FramePadding; + const auto& spacing = ImGui::GetStyle().ItemSpacing; ImGui::PushFont(globals::font_debug); ImGui::SetCursorScreenPos(ImVec2(padding.x + spacing.x, window_size.y - globals::font_debug->FontSize - padding.y - spacing.y)); -- cgit