diff --git a/images/start.png b/images/start.png index b33650714e..68f80e8ea1 100644 Binary files a/images/start.png and b/images/start.png differ diff --git a/launcher/src/client/ui.cpp b/launcher/src/client/ui.cpp index d5bf89eec6..d1bb4e3a50 100644 --- a/launcher/src/client/ui.cpp +++ b/launcher/src/client/ui.cpp @@ -139,16 +139,13 @@ void ConfigurationUI::draw_main() const { state.render_distance = render_distances[render_distance_index]; } // UI Scale - const int precision = std::floor(state.gui_scale) == state.gui_scale ? 0 : 1; - std::string scale_format = "%." + std::to_string(precision) + "fx"; - if (state.gui_scale <= AUTO_GUI_SCALE) { + int gui_scale_int = int(state.gui_scale); // Fractional GUI Scales Are Messy + std::string scale_format = "%ix"; + if (gui_scale_int <= AUTO_GUI_SCALE) { scale_format = "Auto"; } - char display_gui_scale[64]; - sprintf(display_gui_scale, scale_format.c_str(), state.gui_scale); - float new_gui_scale = state.gui_scale; - if (ImGui::SliderFloat(labels[2], &new_gui_scale, 0, 8, display_gui_scale, ImGuiSliderFlags_NoRoundToFormat)) { - state.gui_scale = step_value(new_gui_scale); + if (ImGui::SliderInt(labels[2], &gui_scale_int, 0, 8, scale_format.c_str())) { + state.gui_scale = float(gui_scale_int); if (state.gui_scale < AUTO_GUI_SCALE) { state.gui_scale = AUTO_GUI_SCALE; } diff --git a/libreborn/include/libreborn/util.h b/libreborn/include/libreborn/util.h index 7cb3fd266b..d3900b0b6c 100644 --- a/libreborn/include/libreborn/util.h +++ b/libreborn/include/libreborn/util.h @@ -64,7 +64,4 @@ std::string format_time(const char *fmt, int time); // Default MCPI Port // This Macro DOES NOT Control MCPI -#define DEFAULT_MULTIPLAYER_PORT 19132 - -// Step Value -float step_value(float value, float step = 0.5f); \ No newline at end of file +#define DEFAULT_MULTIPLAYER_PORT 19132 \ No newline at end of file diff --git a/libreborn/src/util/util.cpp b/libreborn/src/util/util.cpp index b9475a745f..3009fb087d 100644 --- a/libreborn/src/util/util.cpp +++ b/libreborn/src/util/util.cpp @@ -135,9 +135,4 @@ std::string format_time(const char *fmt) { std::string format_time(const char *fmt, const int time) { // This Will Break In 2038 return _format_time(fmt, time); -} - -// Step -float step_value(const float value, const float step) { - return std::round(value / step) * step; } \ No newline at end of file diff --git a/mods/src/misc/ui.cpp b/mods/src/misc/ui.cpp index 97755d17c1..f72a3228e2 100644 --- a/mods/src/misc/ui.cpp +++ b/mods/src/misc/ui.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -258,9 +260,16 @@ static void set_gui_scale(const float new_scale) { patch_address((void *) 0x17520, pun.b); } static float calculate_scale(const float value, const float default_value) { - constexpr float initial_scale = 2.5f; - const float scale = initial_scale * (value / default_value); - return step_value(scale); + // y = mx + b + const std::pair point_one = {default_value, 2.25f}; + const std::pair point_two = {default_value * 2, 4.5f}; + const float slope = (point_one.second - point_two.second) / (point_one.first - point_two.first); + const float intercept = point_one.second - (slope * point_one.first); + // Calculate + float scale = (slope * value) + intercept; + scale = std::round(scale); + scale = std::max(scale, 1.0f); + return scale; } static void Minecraft_setSize_injection(Minecraft_setSize_t original, Minecraft *self, const int width, const int height) { // Calculate Scale diff --git a/scripts/screenshot.sh b/scripts/screenshot.sh index c4563eb207..b14b885de2 100755 --- a/scripts/screenshot.sh +++ b/scripts/screenshot.sh @@ -25,7 +25,7 @@ minecraft-pi-reborn --default --no-cache & PID="$!" # Screenshot -sleep 2 +sleep 3 gnome-screenshot --window --file=images/start.png # Kill diff --git a/symbols/src/gui/Font.def b/symbols/src/gui/Font.def index f139c2b3f8..da3c87df4d 100644 --- a/symbols/src/gui/Font.def +++ b/symbols/src/gui/Font.def @@ -1,3 +1,4 @@ method int width(const std::string &string) = 0x24d4c; method void draw(const std::string &string, float x, float y, uint color) = 0x250e0; -method void drawShadow(const std::string &string, float x, float y, uint color) = 0x250ec; \ No newline at end of file +method void drawShadow(const std::string &string, float x, float y, uint color) = 0x250ec; +method void drawSlow(const char *text, float x, float y, uint color, bool param_1) = 0x24fa8; \ No newline at end of file