diff options
| author | untodesu <kirill@untode.su> | 2025-09-14 19:16:44 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-09-14 19:16:44 +0500 |
| commit | 8bcbd2729388edc63c82d77d314b583af1447c49 (patch) | |
| tree | 460c2b509372077f6adf95d72c4245988a580aed /game/client/gui | |
| parent | 7fc7fdb001bea8674fe0dbc1b962f3ec2702debb (diff) | |
| download | voxelius-8bcbd2729388edc63c82d77d314b583af1447c49.tar.bz2 voxelius-8bcbd2729388edc63c82d77d314b583af1447c49.zip | |
Cleanup math with qfengine ports again
Diffstat (limited to 'game/client/gui')
| -rw-r--r-- | game/client/gui/crosshair.cc | 4 | ||||
| -rw-r--r-- | game/client/gui/direct_connection.cc | 2 | ||||
| -rw-r--r-- | game/client/gui/language.cc | 5 | ||||
| -rw-r--r-- | game/client/gui/main_menu.cc | 2 | ||||
| -rw-r--r-- | game/client/gui/play_menu.cc | 4 | ||||
| -rw-r--r-- | game/client/gui/progress_bar.cc | 8 | ||||
| -rw-r--r-- | game/client/gui/scoreboard.cc | 2 | ||||
| -rw-r--r-- | game/client/gui/splash.cc | 2 |
8 files changed, 15 insertions, 14 deletions
diff --git a/game/client/gui/crosshair.cc b/game/client/gui/crosshair.cc index b5650a9..2e6eeba 100644 --- a/game/client/gui/crosshair.cc +++ b/game/client/gui/crosshair.cc @@ -34,8 +34,8 @@ void gui::crosshair::layout(void) auto viewport = ImGui::GetMainViewport();
auto draw_list = ImGui::GetForegroundDrawList();
- auto scaled_width = math::max<int>(texture->size.x, globals::gui_scale * texture->size.x / 2);
- auto scaled_height = math::max<int>(texture->size.y, globals::gui_scale * texture->size.y / 2);
+ auto scaled_width = glm::max<int>(texture->size.x, globals::gui_scale * texture->size.x / 2);
+ auto scaled_height = glm::max<int>(texture->size.y, globals::gui_scale * texture->size.y / 2);
auto start = ImVec2(static_cast<int>(0.5f * viewport->Size.x) - (scaled_width / 2),
static_cast<int>(0.5f * viewport->Size.y) - (scaled_height / 2));
auto end = ImVec2(start.x + scaled_width, start.y + scaled_height);
diff --git a/game/client/gui/direct_connection.cc b/game/client/gui/direct_connection.cc index dfbd05b..c521232 100644 --- a/game/client/gui/direct_connection.cc +++ b/game/client/gui/direct_connection.cc @@ -63,7 +63,7 @@ static void connect_to_server(void) }
if(parts.size() >= 2) {
- parsed_port = math::clamp<std::uint16_t>(strtoul(parts[1].c_str(), nullptr, 10), 1024, UINT16_MAX);
+ parsed_port = glm::clamp<std::uint16_t>(strtoul(parts[1].c_str(), nullptr, 10), 1024, UINT16_MAX);
}
else {
parsed_port = protocol::PORT;
diff --git a/game/client/gui/language.cc b/game/client/gui/language.cc index 57a43fe..d10f88b 100644 --- a/game/client/gui/language.cc +++ b/game/client/gui/language.cc @@ -5,6 +5,7 @@ #include "core/config/string.hh"
#include "core/io/config_map.hh"
+#include "core/io/physfs.hh"
#include "client/gui/settings.hh"
@@ -40,7 +41,7 @@ void gui::language::init(void) auto file = PHYSFS_openRead(std::string(MANIFEST_PATH).c_str());
if(file == nullptr) {
- spdlog::critical("language: {}: {}", MANIFEST_PATH, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+ spdlog::critical("language: {}: {}", MANIFEST_PATH, io::physfs_error());
std::terminate();
}
@@ -113,7 +114,7 @@ void gui::language::set(LanguageIterator new_language) auto file = PHYSFS_openRead(path.c_str());
if(file == nullptr) {
- spdlog::warn("language: {}: {}", path, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
+ spdlog::warn("language: {}: {}", path, io::physfs_error());
send_language_event(new_language);
return;
}
diff --git a/game/client/gui/main_menu.cc b/game/client/gui/main_menu.cc index aa506d3..6c0ee37 100644 --- a/game/client/gui/main_menu.cc +++ b/game/client/gui/main_menu.cc @@ -96,7 +96,7 @@ void gui::main_menu::layout(void) }
else {
auto reference_height = 0.225f * window_size.y;
- auto image_width = math::min(window_size.x, reference_height * title_aspect);
+ auto image_width = glm::min(window_size.x, reference_height * title_aspect);
auto image_height = image_width / title_aspect;
ImGui::SetCursorPosX(0.5f * (window_size.x - image_width));
ImGui::Image(title->handle, ImVec2(image_width, image_height));
diff --git a/game/client/gui/play_menu.cc b/game/client/gui/play_menu.cc index 0747e3a..cd7f730 100644 --- a/game/client/gui/play_menu.cc +++ b/game/client/gui/play_menu.cc @@ -95,7 +95,7 @@ static void parse_hostname(ServerStatusItem* item, const std::string& hostname) }
if(parts.size() >= 2) {
- item->port = math::clamp<std::uint16_t>(strtoul(parts[1].c_str(), nullptr, 10), 1024, UINT16_MAX);
+ item->port = glm::clamp<std::uint16_t>(strtoul(parts[1].c_str(), nullptr, 10), 1024, UINT16_MAX);
}
else {
item->port = protocol::PORT;
@@ -305,7 +305,7 @@ static void layout_server_item(ServerStatusItem* item) auto outline_pos = ImVec2(version_pos.x - 2U * globals::gui_scale, version_pos.y - 2U * globals::gui_scale);
auto outline_end = ImVec2(version_end.x + 2U * globals::gui_scale, version_end.y + 2U * globals::gui_scale);
- auto outline_thickness = math::max<float>(1.0f, 0.5f * static_cast<float>(globals::gui_scale));
+ auto outline_thickness = glm::max<float>(1.0f, 0.5f * static_cast<float>(globals::gui_scale));
draw_list->AddRect(outline_pos, outline_end, version_color, 0.0f, 0, outline_thickness);
draw_list->AddText(version_pos, version_color, version_toast.c_str(), version_toast.c_str() + version_toast.size());
diff --git a/game/client/gui/progress_bar.cc b/game/client/gui/progress_bar.cc index 9266ce1..46277b5 100644 --- a/game/client/gui/progress_bar.cc +++ b/game/client/gui/progress_bar.cc @@ -58,10 +58,10 @@ void gui::progress_bar::layout(void) const float modifier = std::exp(-8.0f * (0.5f + 0.5f * sinval));
ImVec4 color = {};
- color.x = math::lerp(background.x, foreground.x, modifier);
- color.y = math::lerp(background.y, foreground.y, modifier);
- color.z = math::lerp(background.z, foreground.z, modifier);
- color.w = math::lerp(background.w, foreground.w, modifier);
+ color.x = glm::mix(background.x, foreground.x, modifier);
+ color.y = glm::mix(background.y, foreground.y, modifier);
+ color.z = glm::mix(background.z, foreground.z, modifier);
+ color.w = glm::mix(background.w, foreground.w, modifier);
const ImVec2 start = ImVec2(base_xpos + bar_width * i, base_ypos);
const ImVec2 end = ImVec2(start.x + bar_width, start.y + bar_height);
diff --git a/game/client/gui/scoreboard.cc b/game/client/gui/scoreboard.cc index f875ef2..12a4f41 100644 --- a/game/client/gui/scoreboard.cc +++ b/game/client/gui/scoreboard.cc @@ -69,7 +69,7 @@ void gui::scoreboard::layout(void) // Having a minimum size allows for
// generally better in-game visibility
- const float true_size = math::max<float>(0.25f * window_size.x, max_username_size);
+ const float true_size = glm::max<float>(0.25f * window_size.x, max_username_size);
// Figure out username rect dimensions
const float rect_start_x = 0.5f * window_size.x - 0.5f * true_size;
diff --git a/game/client/gui/splash.cc b/game/client/gui/splash.cc index 9990103..5eae0f2 100644 --- a/game/client/gui/splash.cc +++ b/game/client/gui/splash.cc @@ -99,7 +99,7 @@ void gui::client_splash::init_late(void) break;
}
- texture_alpha = math::smoothstep(0.25f, 0.6f, static_cast<float>(remains) / static_cast<float>(DELAY_MICROSECONDS));
+ texture_alpha = glm::smoothstep(0.25f, 0.6f, static_cast<float>(remains) / static_cast<float>(DELAY_MICROSECONDS));
gui::client_splash::render();
}
|
