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)
This commit is contained in:
jerryjhird 2026-03-15 08:16:47 +00:00
parent 1837452f24
commit 0c5a300b1c
2 changed files with 32 additions and 24 deletions

View file

@ -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")));

View file

@ -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<SmallButton *>(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);
}
}