Added some important stuff again
This commit is contained in:
@@ -15,7 +15,7 @@ public class Module_FPS {
|
||||
private static LabelComponent fpsLabel;
|
||||
private static FlowLayout fpsContainer;
|
||||
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)
|
||||
.and(Surface.flat(0x40FFFFFF));
|
||||
@@ -30,7 +30,6 @@ public class Module_FPS {
|
||||
fpsContainer.verticalAlignment(VerticalAlignment.CENTER);
|
||||
fpsContainer.horizontalAlignment(HorizontalAlignment.CENTER);
|
||||
fpsContainer.positioning(Positioning.absolute(10, 10));
|
||||
// start hidden; tick()/first update will populate it
|
||||
fpsContainer.padding(Insets.of(0));
|
||||
}
|
||||
return fpsContainer;
|
||||
@@ -41,7 +40,6 @@ public class Module_FPS {
|
||||
if (fpsContainer == null) return;
|
||||
|
||||
if (toggle && !shown) {
|
||||
// turning on: restore the panel chrome and label
|
||||
fpsContainer.surface(GLASS_PANEL);
|
||||
fpsContainer.padding(Insets.of(6));
|
||||
fpsContainer.child(fpsLabel);
|
||||
|
||||
@@ -294,7 +294,51 @@ public class MyScreen extends BaseOwoScreen<FlowLayout> {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user