Added Module Settings and removed test screen
This commit is contained in:
@@ -9,17 +9,30 @@ import io.wispforest.owo.ui.hud.Hud;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import de.fullrisk.citrusDev.Config;
|
||||
|
||||
public class Module_FPS {
|
||||
|
||||
private static LabelComponent fpsLabel;
|
||||
private static FlowLayout fpsContainer;
|
||||
public static FlowLayout fpsContainer;
|
||||
static boolean toggle = true;
|
||||
private static boolean shown = false;
|
||||
|
||||
private static final Config CONFIG = Config.get();
|
||||
|
||||
private static final Surface GLASS_PANEL = Surface.blur(5f, 15f)
|
||||
.and(Surface.flat(0x40FFFFFF));
|
||||
|
||||
public static void setPosition(int x, int y) {
|
||||
if (fpsContainer != null) {
|
||||
fpsContainer.positioning(Positioning.relative(x, y));
|
||||
}
|
||||
CONFIG.fpsX = x;
|
||||
CONFIG.fpsY = y;
|
||||
CONFIG.save();
|
||||
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
Hud.add(Identifier.fromNamespaceAndPath("citrus-dev", "fps_display"), () -> {
|
||||
if (fpsContainer == null) {
|
||||
@@ -29,8 +42,9 @@ public class Module_FPS {
|
||||
fpsContainer.gap(4);
|
||||
fpsContainer.verticalAlignment(VerticalAlignment.CENTER);
|
||||
fpsContainer.horizontalAlignment(HorizontalAlignment.CENTER);
|
||||
fpsContainer.positioning(Positioning.absolute(10, 10));
|
||||
fpsContainer.padding(Insets.of(0));
|
||||
|
||||
fpsContainer.positioning(Positioning.relative(CONFIG.fpsX, CONFIG.fpsY));
|
||||
}
|
||||
return fpsContainer;
|
||||
});
|
||||
@@ -45,7 +59,6 @@ public class Module_FPS {
|
||||
fpsContainer.child(fpsLabel);
|
||||
shown = true;
|
||||
} else if (!toggle && shown) {
|
||||
// turning off: strip everything so it collapses to nothing
|
||||
fpsContainer.clearChildren();
|
||||
fpsContainer.surface(Surface.flat(0));
|
||||
fpsContainer.padding(Insets.of(0));
|
||||
|
||||
Reference in New Issue
Block a user