Fix to prevent text overlap in options list during scroll

This commit is contained in:
2026-04-26 16:12:56 +02:00
parent 162ec7adfa
commit b3561e773d

View File

@@ -7,6 +7,7 @@
#include "TextOption.h" #include "TextOption.h"
#include "KeyOption.h" #include "KeyOption.h"
#include <algorithm> #include <algorithm>
#include "../Gui.h"
#include "../Screen.h" #include "../Screen.h"
#include "../../../platform/input/Mouse.h" #include "../../../platform/input/Mouse.h"
#include "../../../util/Mth.h" #include "../../../util/Mth.h"
@@ -56,10 +57,20 @@ void OptionsGroup::setupPositions() {
void OptionsGroup::render( Minecraft* minecraft, int xm, int ym ) { void OptionsGroup::render( Minecraft* minecraft, int xm, int ym ) {
float padX = 10.0f; float padX = 10.0f;
float padY = 5.0f; float padY = 5.0f;
const int labelHeight = 18;
minecraft->font->draw(label, (float)x + padX, (float)y + padY, 0xffffffff, false); minecraft->font->draw(label, (float)x + padX, (float)y + padY, 0xffffffff, false);
glEnable2(GL_SCISSOR_TEST);
glScissor(
Gui::GuiScale * x,
minecraft->height - Gui::GuiScale * (y + height),
Gui::GuiScale * width,
Gui::GuiScale * (height - labelHeight)
);
super::render(minecraft, xm, ym); super::render(minecraft, xm, ym);
glDisable2(GL_SCISSOR_TEST);
} }
void OptionsGroup::tick(Minecraft* minecraft) { void OptionsGroup::tick(Minecraft* minecraft) {
@@ -216,4 +227,4 @@ void OptionsGroup::createKey(OptionId optId, Minecraft* minecraft) {
OptionsItem* item = new OptionsItem(optId, itemLabel, element); OptionsItem* item = new OptionsItem(optId, itemLabel, element);
addChild(item); addChild(item);
setupPositions(); setupPositions();
} }