diff options
| author | untodesu <kirill@untode.su> | 2025-09-11 13:48:31 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-09-11 13:48:31 +0500 |
| commit | aaed751bf4430bf4b9b30cef532b8753b9f639ce (patch) | |
| tree | 16bc751c272ba27ad53ec48dbdd3a6d9e6a8d4c2 /game/client/gui | |
| parent | 96bd73ae020ecca1f94698744c77498a89ad19f7 (diff) | |
| download | voxelius-aaed751bf4430bf4b9b30cef532b8753b9f639ce.tar.bz2 voxelius-aaed751bf4430bf4b9b30cef532b8753b9f639ce.zip | |
Replace most of C strings with string_view
Diffstat (limited to 'game/client/gui')
| -rw-r--r-- | game/client/gui/bother.cc | 4 | ||||
| -rw-r--r-- | game/client/gui/bother.hh | 2 | ||||
| -rw-r--r-- | game/client/gui/language.cc | 28 | ||||
| -rw-r--r-- | game/client/gui/language.hh | 6 | ||||
| -rw-r--r-- | game/client/gui/main_menu.cc | 2 | ||||
| -rw-r--r-- | game/client/gui/message_box.cc | 6 | ||||
| -rw-r--r-- | game/client/gui/message_box.hh | 6 | ||||
| -rw-r--r-- | game/client/gui/metrics.cc | 2 | ||||
| -rw-r--r-- | game/client/gui/play_menu.cc | 15 | ||||
| -rw-r--r-- | game/client/gui/progress_bar.cc | 4 | ||||
| -rw-r--r-- | game/client/gui/progress_bar.hh | 4 | ||||
| -rw-r--r-- | game/client/gui/settings.cc | 36 | ||||
| -rw-r--r-- | game/client/gui/settings.hh | 29 | ||||
| -rw-r--r-- | game/client/gui/splash.cc | 2 | ||||
| -rw-r--r-- | game/client/gui/window_title.cc | 4 |
15 files changed, 77 insertions, 73 deletions
diff --git a/game/client/gui/bother.cc b/game/client/gui/bother.cc index 3a35438..d87f220 100644 --- a/game/client/gui/bother.cc +++ b/game/client/gui/bother.cc @@ -117,7 +117,7 @@ void gui::bother::update_late(void) } } -void gui::bother::ping(unsigned int identity, const char* host, std::uint16_t port) +void gui::bother::ping(unsigned int identity, std::string_view host, std::uint16_t port) { if(bother_set.count(identity)) { // Already in the process @@ -133,7 +133,7 @@ void gui::bother::ping(unsigned int identity, const char* host, std::uint16_t po BotherQueueItem item; item.identity = identity; - item.hostname = std::string(host); + item.hostname = host; item.port = port; bother_queue.push_back(item); diff --git a/game/client/gui/bother.hh b/game/client/gui/bother.hh index c10bf8a..f555d74 100644 --- a/game/client/gui/bother.hh +++ b/game/client/gui/bother.hh @@ -19,7 +19,7 @@ namespace gui::bother void init(void); void shutdown(void); void update_late(void); -void ping(unsigned int identity, const char* host, std::uint16_t port); +void ping(unsigned int identity, std::string_view host, std::uint16_t port); void cancel(unsigned int identity); } // namespace gui::bother diff --git a/game/client/gui/language.cc b/game/client/gui/language.cc index b5bdc7d..3c700a2 100644 --- a/game/client/gui/language.cc +++ b/game/client/gui/language.cc @@ -9,13 +9,13 @@ #include "client/globals.hh" -constexpr static const char* DEFAULT_LANGUAGE = "en_US"; +constexpr static std::string_view DEFAULT_LANGUAGE = "en_US"; // Available languages are kept in a special manifest file which // is essentially a key-value map of semi-IETF-compliant language tags // and the language's endonym; after reading the manifest, the translation // system knows what language it can load and will act accordingly -constexpr static const char* MANIFEST_PATH = "lang/manifest.json"; +constexpr static std::string_view MANIFEST_PATH = "lang/manifest.json"; static gui::LanguageManifest manifest; static gui::LanguageIterator current_language; @@ -36,7 +36,7 @@ void gui::language::init(void) settings::add_language_select(0, settings_location::GENERAL, "language"); - auto file = PHYSFS_openRead(MANIFEST_PATH); + auto file = PHYSFS_openRead(std::string(MANIFEST_PATH).c_str()); if(file == nullptr) { spdlog::critical("language: {}: {}", MANIFEST_PATH, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); @@ -85,14 +85,14 @@ void gui::language::init(void) void gui::language::init_late(void) { - auto user_language = ietf_map.find(config_language.get()); + auto user_language = ietf_map.find(config_language.get_value()); if(user_language != ietf_map.cend()) { gui::language::set(user_language->second); return; } - auto fallback = ietf_map.find(DEFAULT_LANGUAGE); + auto fallback = ietf_map.find(std::string(DEFAULT_LANGUAGE)); if(fallback != ietf_map.cend()) { gui::language::set(fallback->second); @@ -159,9 +159,9 @@ gui::LanguageIterator gui::language::get_current(void) return current_language; } -gui::LanguageIterator gui::language::find(const char* ietf) +gui::LanguageIterator gui::language::find(std::string_view ietf) { - const auto it = ietf_map.find(ietf); + const auto it = ietf_map.find(std::string(ietf)); if(it != ietf_map.cend()) { return it->second; } @@ -180,18 +180,18 @@ gui::LanguageIterator gui::language::cend(void) return manifest.cend(); } -const char* gui::language::resolve(const char* key) +std::string_view gui::language::resolve(std::string_view key) { - const auto it = language_map.find(key); + const auto it = language_map.find(std::string(key)); + if(it != language_map.cend()) { - return it->second.c_str(); - } - else { - return key; + return it->second; } + + return key; } -std::string gui::language::resolve_gui(const char* key) +std::string gui::language::resolve_gui(std::string_view key) { // We need window tags to retain their hierarchy when a language // dynamically changes; ImGui allows to provide hidden unique identifiers diff --git a/game/client/gui/language.hh b/game/client/gui/language.hh index d54208a..37cc790 100644 --- a/game/client/gui/language.hh +++ b/game/client/gui/language.hh @@ -32,15 +32,15 @@ void set(LanguageIterator new_language); namespace gui::language { LanguageIterator get_current(void); -LanguageIterator find(const char* ietf); +LanguageIterator find(std::string_view ietf); LanguageIterator cbegin(void); LanguageIterator cend(void); } // namespace gui::language namespace gui::language { -const char* resolve(const char* key); -std::string resolve_gui(const char* key); +std::string_view resolve(std::string_view key); +std::string resolve_gui(std::string_view key); } // namespace gui::language #endif // CLIENT_LANGUAGE_HH diff --git a/game/client/gui/main_menu.cc b/game/client/gui/main_menu.cc index 37ee398..62802a8 100644 --- a/game/client/gui/main_menu.cc +++ b/game/client/gui/main_menu.cc @@ -158,7 +158,7 @@ void gui::main_menu::layout(void) ImGui::PushFont(globals::font_debug); ImGui::SetCursorScreenPos(ImVec2(padding.x + spacing.x, window_size.y - globals::font_debug->FontSize - padding.y - spacing.y)); - ImGui::Text("Voxelius %s", project_version_string); + ImGui::Text("Voxelius %*s", version::semver.size(), version::semver.data()); // string_view is not always null-terminated ImGui::PopFont(); } diff --git a/game/client/gui/message_box.cc b/game/client/gui/message_box.cc index 615281b..59e2d33 100644 --- a/game/client/gui/message_box.cc +++ b/game/client/gui/message_box.cc @@ -75,17 +75,17 @@ void gui::message_box::reset(void) buttons.clear(); } -void gui::message_box::set_title(const char* title) +void gui::message_box::set_title(std::string_view title) { str_title = gui::language::resolve(title); } -void gui::message_box::set_subtitle(const char* subtitle) +void gui::message_box::set_subtitle(std::string_view subtitle) { str_subtitle = gui::language::resolve(subtitle); } -void gui::message_box::add_button(const char* text, const message_box_action& action) +void gui::message_box::add_button(std::string_view text, const message_box_action& action) { Button button = {}; button.str_title = std::format("{}###MessageBox_Button{}", gui::language::resolve(text), buttons.size()); diff --git a/game/client/gui/message_box.hh b/game/client/gui/message_box.hh index c5545fc..a906744 100644 --- a/game/client/gui/message_box.hh +++ b/game/client/gui/message_box.hh @@ -16,9 +16,9 @@ void reset(void); namespace gui::message_box { -void set_title(const char* title); -void set_subtitle(const char* subtitle); -void add_button(const char* text, const message_box_action& action); +void set_title(std::string_view title); +void set_subtitle(std::string_view subtitle); +void add_button(std::string_view text, const message_box_action& action); } // namespace gui::message_box #endif // CLIENT_MESSAGE_BOX_HH diff --git a/game/client/gui/metrics.cc b/game/client/gui/metrics.cc index 350208c..f439fd0 100644 --- a/game/client/gui/metrics.cc +++ b/game/client/gui/metrics.cc @@ -50,7 +50,7 @@ void gui::metrics::layout(void) auto y_step = 1.5f * globals::font_debug->FontSize; // Draw version - auto version_line = std::format("Voxelius {}", project_version_string); + auto version_line = std::format("Voxelius {} [{}]", version::semver, version::commit); gui::imdraw_ext::text_shadow(version_line, position, text_color, shadow_color, globals::font_debug, draw_list); position.y += 1.5f * y_step; diff --git a/game/client/gui/play_menu.cc b/game/client/gui/play_menu.cc index f2a8887..dc4ffed 100644 --- a/game/client/gui/play_menu.cc +++ b/game/client/gui/play_menu.cc @@ -19,9 +19,9 @@ #include "client/session.hh" constexpr static ImGuiWindowFlags WINDOW_FLAGS = ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoDecoration; -constexpr static const char* DEFAULT_SERVER_NAME = "Voxelius Server"; -constexpr static const char* SERVERS_TXT = "servers.txt"; -constexpr static const char* WARNING_TOAST = "[!]"; +constexpr static std::string_view DEFAULT_SERVER_NAME = "Voxelius Server"; +constexpr static std::string_view SERVERS_TXT = "servers.txt"; +constexpr static std::string_view WARNING_TOAST = "[!]"; constexpr static std::size_t MAX_SERVER_ITEM_NAME = 24; @@ -265,10 +265,11 @@ static void layout_server_item(ServerStatusItem* item) draw_list->AddText(stats_pos, ImGui::GetColorU32(ImGuiCol_TextDisabled), stats.c_str(), stats.c_str() + stats.size()); if(item->protocol_version != protocol::VERSION) { - auto warning_size = ImGui::CalcTextSize(WARNING_TOAST); + auto warning_size = ImGui::CalcTextSize(WARNING_TOAST.data(), WARNING_TOAST.data() + WARNING_TOAST.size()); auto warning_pos = ImVec2(stats_pos.x - warning_size.x - padding.x - 4.0f * globals::gui_scale, cursor.y + padding.y); auto warning_end = ImVec2(warning_pos.x + warning_size.x, warning_pos.y + warning_size.y); - draw_list->AddText(warning_pos, ImGui::GetColorU32(ImGuiCol_DragDropTarget), WARNING_TOAST); + draw_list->AddText(warning_pos, ImGui::GetColorU32(ImGuiCol_DragDropTarget), WARNING_TOAST.data(), + WARNING_TOAST.data() + WARNING_TOAST.size()); if(ImGui::IsMouseHoveringRect(warning_pos, warning_end)) { ImGui::BeginTooltip(); @@ -442,7 +443,7 @@ static void layout_servers_buttons(void) void gui::play_menu::init(void) { - if(auto file = PHYSFS_openRead(SERVERS_TXT)) { + if(auto file = PHYSFS_openRead(std::string(SERVERS_TXT).c_str())) { auto source = std::string(PHYSFS_fileLength(file), char(0x00)); PHYSFS_readBytes(file, source.data(), source.size()); PHYSFS_close(file); @@ -496,7 +497,7 @@ void gui::play_menu::shutdown(void) stream << std::format("{}:{}%{}%{}", item->hostname, item->port, item->password, item->name) << std::endl; } - if(auto file = PHYSFS_openWrite(SERVERS_TXT)) { + if(auto file = PHYSFS_openWrite(std::string(SERVERS_TXT).c_str())) { auto source = stream.str(); PHYSFS_writeBytes(file, source.data(), source.size()); PHYSFS_close(file); diff --git a/game/client/gui/progress_bar.cc b/game/client/gui/progress_bar.cc index 2bfb69e..8be2f8c 100644 --- a/game/client/gui/progress_bar.cc +++ b/game/client/gui/progress_bar.cc @@ -99,12 +99,12 @@ void gui::progress_bar::reset(void) button_action = nullptr; } -void gui::progress_bar::set_title(const char* title) +void gui::progress_bar::set_title(std::string_view title) { str_title = gui::language::resolve(title); } -void gui::progress_bar::set_button(const char* text, const progress_bar_action& action) +void gui::progress_bar::set_button(std::string_view text, const progress_bar_action& action) { str_button = std::format("{}###ProgressBar_Button", gui::language::resolve(text)); button_action = action; diff --git a/game/client/gui/progress_bar.hh b/game/client/gui/progress_bar.hh index 3765543..79fdcb5 100644 --- a/game/client/gui/progress_bar.hh +++ b/game/client/gui/progress_bar.hh @@ -16,8 +16,8 @@ void layout(void); namespace gui::progress_bar { void reset(void); -void set_title(const char* title); -void set_button(const char* text, const progress_bar_action& action); +void set_title(std::string_view title); +void set_button(std::string_view text, const progress_bar_action& action); } // namespace gui::progress_bar #endif // CLIENT_PROGRESS_BAR_HH diff --git a/game/client/gui/settings.cc b/game/client/gui/settings.cc index 034db4c..e8f9bca 100644 --- a/game/client/gui/settings.cc +++ b/game/client/gui/settings.cc @@ -311,7 +311,7 @@ void SettingValue_InputUnsigned::layout(void) const void SettingValue_InputString::layout(void) const { ImGuiInputTextFlags flags; - std::string current_value = value->get(); + std::string current_value(value->get_value()); if(allow_whitespace) { flags = ImGuiInputTextFlags_AllowTabInput; @@ -321,7 +321,7 @@ void SettingValue_InputString::layout(void) const } if(ImGui::InputText(wid.c_str(), ¤t_value, flags)) { - value->set(current_value.c_str()); + value->set(current_value); } layout_label(); @@ -847,7 +847,7 @@ void settings::layout(void) ImGui::End(); } -void settings::add_checkbox(int priority, config::Boolean& value, settings_location location, const char* name, bool tooltip) +void settings::add_checkbox(int priority, config::Boolean& value, settings_location location, std::string_view name, bool tooltip) { auto setting_value = new SettingValue_CheckBox; setting_value->type = setting_type::CHECKBOX; @@ -862,7 +862,7 @@ void settings::add_checkbox(int priority, config::Boolean& value, settings_locat values_all.push_back(setting_value); } -void settings::add_input(int priority, config::Int& value, settings_location location, const char* name, bool tooltip) +void settings::add_input(int priority, config::Int& value, settings_location location, std::string_view name, bool tooltip) { auto setting_value = new SettingValue_InputInt; setting_value->type = setting_type::INPUT_INT; @@ -877,13 +877,15 @@ void settings::add_input(int priority, config::Int& value, settings_location loc values_all.push_back(setting_value); } -void settings::add_input(int priority, config::Float& value, settings_location location, const char* name, bool tooltip, const char* format) +void settings::add_input( + int priority, config::Float& value, settings_location location, std::string_view name, bool tooltip, std::string_view fmt) { auto setting_value = new SettingValue_InputFloat; setting_value->type = setting_type::INPUT_FLOAT; setting_value->priority = priority; setting_value->has_tooltip = tooltip; setting_value->value = &value; + setting_value->format = fmt; setting_value->name = name; setting_value->wid = std::format("###{}", static_cast<const void*>(setting_value->value)); @@ -892,7 +894,7 @@ void settings::add_input(int priority, config::Float& value, settings_location l values_all.push_back(setting_value); } -void settings::add_input(int priority, config::Unsigned& value, settings_location location, const char* name, bool tooltip) +void settings::add_input(int priority, config::Unsigned& value, settings_location location, std::string_view name, bool tooltip) { auto setting_value = new SettingValue_InputUnsigned; setting_value->type = setting_type::INPUT_UINT; @@ -908,7 +910,7 @@ void settings::add_input(int priority, config::Unsigned& value, settings_locatio } void settings::add_input( - int priority, config::String& value, settings_location location, const char* name, bool tooltip, bool allow_whitespace) + int priority, config::String& value, settings_location location, std::string_view name, bool tooltip, bool allow_whitespace) { auto setting_value = new SettingValue_InputString; setting_value->type = setting_type::INPUT_STRING; @@ -924,7 +926,7 @@ void settings::add_input( values_all.push_back(setting_value); } -void settings::add_slider(int priority, config::Int& value, settings_location location, const char* name, bool tooltip) +void settings::add_slider(int priority, config::Int& value, settings_location location, std::string_view name, bool tooltip) { auto setting_value = new SettingValue_SliderInt; setting_value->type = setting_type::SLIDER_INT; @@ -940,7 +942,7 @@ void settings::add_slider(int priority, config::Int& value, settings_location lo } void settings::add_slider( - int priority, config::Float& value, settings_location location, const char* name, bool tooltip, const char* format) + int priority, config::Float& value, settings_location location, std::string_view name, bool tooltip, std::string_view fmt) { auto setting_value = new SettingValue_SliderFloat; setting_value->type = setting_type::SLIDER_FLOAT; @@ -949,14 +951,14 @@ void settings::add_slider( setting_value->value = &value; setting_value->name = name; - setting_value->format = format; + setting_value->format = fmt; setting_value->wid = std::format("###{}", static_cast<const void*>(setting_value->value)); values[static_cast<unsigned int>(location)].push_back(setting_value); values_all.push_back(setting_value); } -void settings::add_slider(int priority, config::Unsigned& value, settings_location location, const char* name, bool tooltip) +void settings::add_slider(int priority, config::Unsigned& value, settings_location location, std::string_view name, bool tooltip) { auto setting_value = new SettingValue_SliderUnsigned; setting_value->type = setting_type::SLIDER_UINT; @@ -971,7 +973,7 @@ void settings::add_slider(int priority, config::Unsigned& value, settings_locati values_all.push_back(setting_value); } -void settings::add_stepper(int priority, config::Int& value, settings_location location, const char* name, bool tooltip) +void settings::add_stepper(int priority, config::Int& value, settings_location location, std::string_view name, bool tooltip) { auto setting_value = new SettingValue_StepperInt; setting_value->type = setting_type::STEPPER_INT; @@ -987,7 +989,7 @@ void settings::add_stepper(int priority, config::Int& value, settings_location l values_all.push_back(setting_value); } -void settings::add_stepper(int priority, config::Unsigned& value, settings_location location, const char* name, bool tooltip) +void settings::add_stepper(int priority, config::Unsigned& value, settings_location location, std::string_view name, bool tooltip) { auto setting_value = new SettingValue_StepperUnsigned; setting_value->type = setting_type::STEPPER_UINT; @@ -1003,7 +1005,7 @@ void settings::add_stepper(int priority, config::Unsigned& value, settings_locat values_all.push_back(setting_value); } -void settings::add_keybind(int priority, config::KeyBind& value, settings_location location, const char* name) +void settings::add_keybind(int priority, config::KeyBind& value, settings_location location, std::string_view name) { auto setting_value = new SettingValue_KeyBind; setting_value->type = setting_type::KEYBIND; @@ -1018,7 +1020,7 @@ void settings::add_keybind(int priority, config::KeyBind& value, settings_locati values_all.push_back(setting_value); } -void settings::add_gamepad_axis(int priority, config::GamepadAxis& value, settings_location location, const char* name) +void settings::add_gamepad_axis(int priority, config::GamepadAxis& value, settings_location location, std::string_view name) { auto setting_value = new SettingValue_GamepadAxis; setting_value->type = setting_type::GAMEPAD_AXIS; @@ -1033,7 +1035,7 @@ void settings::add_gamepad_axis(int priority, config::GamepadAxis& value, settin values_all.push_back(setting_value); } -void settings::add_gamepad_button(int priority, config::GamepadButton& value, settings_location location, const char* name) +void settings::add_gamepad_button(int priority, config::GamepadButton& value, settings_location location, std::string_view name) { auto setting_value = new SettingValue_GamepadButton; setting_value->type = setting_type::GAMEPAD_BUTTON; @@ -1048,7 +1050,7 @@ void settings::add_gamepad_button(int priority, config::GamepadButton& value, se values_all.push_back(setting_value); } -void settings::add_language_select(int priority, settings_location location, const char* name) +void settings::add_language_select(int priority, settings_location location, std::string_view name) { auto setting_value = new SettingValue_Language; setting_value->type = setting_type::LANGUAGE_SELECT; diff --git a/game/client/gui/settings.hh b/game/client/gui/settings.hh index 15aa6a7..d807bc4 100644 --- a/game/client/gui/settings.hh +++ b/game/client/gui/settings.hh @@ -49,45 +49,46 @@ void layout(void); namespace settings { -void add_checkbox(int priority, config::Boolean& value, settings_location location, const char* name, bool tooltip); +void add_checkbox(int priority, config::Boolean& value, settings_location location, std::string_view name, bool tooltip); } // namespace settings namespace settings { -void add_input(int priority, config::Int& value, settings_location location, const char* name, bool tooltip); -void add_input(int priority, config::Float& value, settings_location location, const char* name, bool tooltip, const char* format = "%.3f"); -void add_input(int priority, config::Unsigned& value, settings_location location, const char* name, bool tooltip); -void add_input(int priority, config::String& value, settings_location location, const char* name, bool tooltip, bool allow_whitespace); +void add_input(int priority, config::Int& value, settings_location location, std::string_view name, bool tooltip); +void add_input( + int priority, config::Float& value, settings_location location, std::string_view name, bool tooltip, std::string_view fmt = "%.3f"); +void add_input(int priority, config::Unsigned& value, settings_location location, std::string_view name, bool tooltip); +void add_input(int priority, config::String& value, settings_location location, std::string_view name, bool tooltip, bool allow_whitespace); } // namespace settings namespace settings { -void add_slider(int priority, config::Int& value, settings_location location, const char* name, bool tooltip); +void add_slider(int priority, config::Int& value, settings_location location, std::string_view name, bool tooltip); void add_slider( - int priority, config::Float& value, settings_location location, const char* name, bool tooltip, const char* format = "%.3f"); -void add_slider(int priority, config::Unsigned& value, settings_location location, const char* name, bool tooltip); + int priority, config::Float& value, settings_location location, std::string_view name, bool tooltip, std::string_view format = "%.3f"); +void add_slider(int priority, config::Unsigned& value, settings_location location, std::string_view name, bool tooltip); } // namespace settings namespace settings { -void add_stepper(int priority, config::Int& value, settings_location location, const char* name, bool tooltip); -void add_stepper(int priority, config::Unsigned& value, settings_location location, const char* name, bool tooltip); +void add_stepper(int priority, config::Int& value, settings_location location, std::string_view name, bool tooltip); +void add_stepper(int priority, config::Unsigned& value, settings_location location, std::string_view name, bool tooltip); } // namespace settings namespace settings { -void add_keybind(int priority, config::KeyBind& value, settings_location location, const char* name); +void add_keybind(int priority, config::KeyBind& value, settings_location location, std::string_view name); } // namespace settings namespace settings { -void add_gamepad_axis(int priority, config::GamepadAxis& value, settings_location location, const char* name); -void add_gamepad_button(int priority, config::GamepadButton& value, settings_location location, const char* name); +void add_gamepad_axis(int priority, config::GamepadAxis& value, settings_location location, std::string_view name); +void add_gamepad_button(int priority, config::GamepadButton& value, settings_location location, std::string_view name); } // namespace settings namespace settings { -void add_language_select(int priority, settings_location location, const char* name); +void add_language_select(int priority, settings_location location, std::string_view name); } // namespace settings #endif // CLIENT_SETTINGS_HH diff --git a/game/client/gui/splash.cc b/game/client/gui/splash.cc index a144f97..9eed8d3 100644 --- a/game/client/gui/splash.cc +++ b/game/client/gui/splash.cc @@ -18,7 +18,7 @@ constexpr static ImGuiWindowFlags WINDOW_FLAGS = ImGuiWindowFlags_NoBackground | constexpr static int SPLASH_COUNT = 4; constexpr static std::size_t DELAY_MICROSECONDS = 2000000; -constexpr static const char* SPLASH_PATH = "textures/gui/client_splash.png"; +constexpr static std::string_view SPLASH_PATH = "textures/gui/client_splash.png"; static resource_ptr<TextureGUI> texture; static float texture_aspect; diff --git a/game/client/gui/window_title.cc b/game/client/gui/window_title.cc index 91e308f..6f46668 100644 --- a/game/client/gui/window_title.cc +++ b/game/client/gui/window_title.cc @@ -13,10 +13,10 @@ void gui::window_title::update(void) std::string title; if(globals::sound_ctx && globals::sound_dev) { - title = std::format("Voxelius {}: {}", project_version_string, splash::get()); + title = std::format("Voxelius {}: {}", version::semver, splash::get()); } else { - title = std::format("Voxelius {}: {} [NOSOUND]", project_version_string, splash::get()); + title = std::format("Voxelius {}: {} [NOSOUND]", version::semver, splash::get()); } glfwSetWindowTitle(globals::window, title.c_str()); |
