Added some important stuff again

This commit is contained in:
2026-07-07 21:46:26 +02:00
parent 23634126ec
commit 57769eecb7
4 changed files with 46 additions and 4 deletions
@@ -15,7 +15,7 @@ public class Module_FPS {
private static LabelComponent fpsLabel; private static LabelComponent fpsLabel;
private static FlowLayout fpsContainer; private static FlowLayout fpsContainer;
static boolean toggle = true; static boolean toggle = true;
private static boolean shown = false; // tracks current visible/built state private static boolean shown = false;
private static final Surface GLASS_PANEL = Surface.blur(5f, 15f) private static final Surface GLASS_PANEL = Surface.blur(5f, 15f)
.and(Surface.flat(0x40FFFFFF)); .and(Surface.flat(0x40FFFFFF));
@@ -30,7 +30,6 @@ public class Module_FPS {
fpsContainer.verticalAlignment(VerticalAlignment.CENTER); fpsContainer.verticalAlignment(VerticalAlignment.CENTER);
fpsContainer.horizontalAlignment(HorizontalAlignment.CENTER); fpsContainer.horizontalAlignment(HorizontalAlignment.CENTER);
fpsContainer.positioning(Positioning.absolute(10, 10)); fpsContainer.positioning(Positioning.absolute(10, 10));
// start hidden; tick()/first update will populate it
fpsContainer.padding(Insets.of(0)); fpsContainer.padding(Insets.of(0));
} }
return fpsContainer; return fpsContainer;
@@ -41,7 +40,6 @@ public class Module_FPS {
if (fpsContainer == null) return; if (fpsContainer == null) return;
if (toggle && !shown) { if (toggle && !shown) {
// turning on: restore the panel chrome and label
fpsContainer.surface(GLASS_PANEL); fpsContainer.surface(GLASS_PANEL);
fpsContainer.padding(Insets.of(6)); fpsContainer.padding(Insets.of(6));
fpsContainer.child(fpsLabel); fpsContainer.child(fpsLabel);
@@ -294,7 +294,51 @@ public class MyScreen extends BaseOwoScreen<FlowLayout> {
} }
private void buildSettingsPanel(FlowLayout content) { private void buildSettingsPanel(FlowLayout content) {
content.child(UIComponents.label(Component.literal("Settings tab - coming soon"))); content.child(UIComponents.label(Component.literal("Settings")));
content.child(makeCyclingButton());
}
private record ButtonState(String label, Runnable onSelect) {}
private FlowLayout makeCyclingButton() { // muss ich noch fertig machen, bitte es geht mir nd gut, es ist 23:00
List<ButtonState> states = List.of(
new ButtonState("Off", () -> {
}),
new ButtonState("Low", () -> {
}),
new ButtonState("Medium", () -> {
}),
new ButtonState("High", () -> {
})
);
int[] currentIndex = {0};
FlowLayout button = UIContainers.verticalFlow(Sizing.fixed(60), Sizing.fixed(20));
button.verticalAlignment(VerticalAlignment.CENTER);
button.horizontalAlignment(HorizontalAlignment.CENTER);
button.surface(FLAT);
var label = UIComponents.label(Component.literal(states.get(0).label()))
.color(Color.ofRgb(0xFFFFFF));
button.child(label);
button.mouseDown().subscribe((click, doubled) -> {
Minecraft.getInstance().getSoundManager().play(
SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK.value(), 2.0F, 2)
);
currentIndex[0] = (currentIndex[0] + 1) % states.size();
ButtonState newState = states.get(currentIndex[0]);
label.text(Component.literal(newState.label()));
newState.onSelect().run();
return true;
});
return button;
} }
private FlowLayout makeSmallButton(Surface baseSurface, Identifier texture, Runnable onClick) { private FlowLayout makeSmallButton(Surface baseSurface, Identifier texture, Runnable onClick) {
Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B