From 0c5a300b1ce771a62df3f0fdcb71ff5dac09104b Mon Sep 17 00:00:00 2001 From: jerryjhird Date: Sun, 15 Mar 2026 08:16:47 +0000 Subject: [PATCH] added brightness and FOV sliders to grahpic settings as well as changed weird text in PauseScreen (also adds sliding logic to sliders so you can drag them with your mouse) --- Minecraft.Client/UI/Screens/PauseScreen.cpp | 4 +- .../UI/Screens/VideoSettingsScreen.cpp | 52 +++++++++++-------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/Minecraft.Client/UI/Screens/PauseScreen.cpp b/Minecraft.Client/UI/Screens/PauseScreen.cpp index 5fafa8561..30e2c7904 100644 --- a/Minecraft.Client/UI/Screens/PauseScreen.cpp +++ b/Minecraft.Client/UI/Screens/PauseScreen.cpp @@ -30,8 +30,8 @@ void PauseScreen::init() } - buttons.push_back(new Button(4, width / 2 - 100, height / 4 + 24 * 1 + yo, L"LBack to game")); - buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + yo, L"LOptions...")); + buttons.push_back(new Button(4, width / 2 - 100, height / 4 + 24 * 1 + yo, I18n::get(L"menu.returnToGame"))); + buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + yo, I18n::get(L"menu.options"))); buttons.push_back(new Button(5, width / 2 - 100, height / 4 + 24 * 2 + yo, 98, 20, I18n::get(L"gui.achievements"))); buttons.push_back(new Button(6, width / 2 + 2, height / 4 + 24 * 2 + yo, 98, 20, I18n::get(L"gui.stats"))); diff --git a/Minecraft.Client/UI/Screens/VideoSettingsScreen.cpp b/Minecraft.Client/UI/Screens/VideoSettingsScreen.cpp index 2b765d59f..a7c0d87f3 100644 --- a/Minecraft.Client/UI/Screens/VideoSettingsScreen.cpp +++ b/Minecraft.Client/UI/Screens/VideoSettingsScreen.cpp @@ -18,28 +18,38 @@ void VideoSettingsScreen::init() Language *language = Language::getInstance(); this->title = language->getElement(L"options.videoTitle"); - // 4J - this was as static array but moving it into the function to remove any issues with static initialisation order - const Options::Option *items[8] = { - Options::Option::GRAPHICS, Options::Option::RENDER_DISTANCE, Options::Option::AMBIENT_OCCLUSION, Options::Option::FRAMERATE_LIMIT, Options::Option::ANAGLYPH, Options::Option::VIEW_BOBBING, - Options::Option::GUI_SCALE, Options::Option::ADVANCED_OPENGL - }; + const Options::Option *items[10] = { + Options::Option::GRAPHICS, + Options::Option::RENDER_DISTANCE, + Options::Option::AMBIENT_OCCLUSION, + Options::Option::FRAMERATE_LIMIT, + Options::Option::ANAGLYPH, + Options::Option::VIEW_BOBBING, + Options::Option::GUI_SCALE, + Options::Option::ADVANCED_OPENGL, + Options::Option::GAMMA, + Options::Option::FOV + }; + + for (int i = 0; i < 10; i++) + { + const Options::Option *item = items[i]; + int xPos = width / 2 - 155 + (i % 2 * 160); + int yPos = height / 6 + 24 * (i / 2); - for (int position = 0; position < 8; position++) - { - const Options::Option *item = items[position]; if (!item->isProgress()) - { - buttons.push_back(new SmallButton(item->getId(), width / 2 - 155 + position % 2 * 160, height / 6 + 24 * (position >> 1), item, options->getMessage(item))); + { + buttons.push_back(new SmallButton(item->getId(), xPos, yPos, item, options->getMessage(item))); } - else - { - buttons.push_back(new SlideButton(item->getId(), width / 2 - 155 + position % 2 * 160, height / 6 + 24 * (position >> 1), item, options->getMessage(item), options->getProgressValue(item))); + else + { + buttons.push_back(new SlideButton(item->getId(), xPos, yPos, item, options->getMessage(item), options->getProgressValue(item))); } } // buttons.add(new Button(VIDEO_BUTTON_ID, width / 2 - 100, height / 6 + 24 * 4 + 12, language.getElement("options.video"))); // buttons.add(new Button(CONTROLS_BUTTON_ID, width / 2 - 100, height / 6 + 24 * 5 + 12, language.getElement("options.controls"))); - buttons.push_back(new Button(200, width / 2 - 100, height / 6 + 24 * 7, language->getElement(L"gui.done"))); + buttons.push_back(new Button(200, width / 2 - 100, height / 6 + 24 * 6, language->getElement(L"gui.done"))); } @@ -47,25 +57,23 @@ void VideoSettingsScreen::buttonClicked(Button *button) { if (!button->active) return; if (button->id < 100 && (dynamic_cast(button) != NULL)) - { + { options->toggle(((SmallButton *) button)->getOption(), 1); button->msg = options->getMessage(Options::Option::getItem(button->id)); + return; } if (button->id == 200) - { + { minecraft->options->save(); minecraft->setScreen(lastScreen); + return; } - - ScreenSizeCalculator ssc(minecraft->options, minecraft->width, minecraft->height); - int screenWidth = ssc.getWidth(); - int screenHeight = ssc.getHeight(); - Screen::init(minecraft, screenWidth, screenHeight); // 4J - was this.init } void VideoSettingsScreen::render(int xm, int ym, float a) { renderBackground(); drawCenteredString(font, title, width / 2, 20, 0xffffff); + Screen::render(xm, ym, a); -} +} \ No newline at end of file