diff --git a/src/main/java/de/fullrisk/citrusDev/UI/CreditsScreen.java b/src/main/java/de/fullrisk/citrusDev/UI/CreditsScreen.java new file mode 100644 index 0000000..3dbfb1d --- /dev/null +++ b/src/main/java/de/fullrisk/citrusDev/UI/CreditsScreen.java @@ -0,0 +1,107 @@ +package de.fullrisk.citrusDev.UI; + +import de.fullrisk.citrusDev.UIHelper.SettingsControls; +import io.wispforest.owo.ui.base.BaseOwoScreen; +import io.wispforest.owo.ui.component.UIComponents; +import io.wispforest.owo.ui.container.FlowLayout; +import io.wispforest.owo.ui.container.UIContainers; +import io.wispforest.owo.ui.core.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.sounds.SimpleSoundInstance; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.FontDescription; +import net.minecraft.sounds.SoundEvents; + +import java.util.List; + +import static de.fullrisk.citrusDev.UI.MainUI.buildPanelSurface; +import static de.fullrisk.citrusDev.UI.MainUI.MC_FIVE; + +public class CreditsScreen extends BaseOwoScreen { + + public static Surface PANEL_SURFACE = buildPanelSurface(); + + private static final int PANEL_WIDTH = 180; + private static final int PANEL_HEIGHT = 120; + + private static final List CREDITS = List.of( + "citrus team - testing", + "owo-ui - framework", + "nrc - inspiration" + ); + + public CreditsScreen() { + super(Component.literal("Credits")); + Minecraft.getInstance().getSoundManager().play( + SimpleSoundInstance.forUI(SoundEvents.UI_TOAST_IN, 1.5F, 2) + ); + } + + @Override + protected OwoUIAdapter createAdapter() { + return OwoUIAdapter.create(this, UIContainers::verticalFlow); + } + + @Override + protected void build(FlowLayout rootComponent) { + rootComponent.horizontalAlignment(HorizontalAlignment.CENTER) + .verticalAlignment(VerticalAlignment.CENTER); + + FlowLayout panel = UIContainers.verticalFlow(Sizing.fixed(PANEL_WIDTH), Sizing.fixed(PANEL_HEIGHT)); + panel.gap(6); + panel.padding(Insets.of(8)); + panel.horizontalAlignment(HorizontalAlignment.CENTER); + panel.verticalAlignment(VerticalAlignment.TOP); + panel.surface(PANEL_SURFACE); + + var title = UIComponents.label(Component.literal("Credits") + .withStyle(s -> s.withFont(new FontDescription.Resource(MC_FIVE)))) + .color(Color.ofRgb(0xFFFFFF)) + .horizontalTextAlignment(HorizontalAlignment.CENTER); + panel.child(title); + + FlowLayout list = UIContainers.verticalFlow(Sizing.fixed(PANEL_WIDTH - 16), Sizing.content()); + list.gap(4); + list.horizontalAlignment(HorizontalAlignment.CENTER); + + for (String entry : CREDITS) { + var line = UIComponents.label(Component.literal(entry) + .withStyle(s -> s.withFont(new FontDescription.Resource(MC_FIVE)))) + .color(Color.ofRgb(0xB0B6C0)) + .horizontalTextAlignment(HorizontalAlignment.CENTER); + list.child(line); + } + panel.child(list); + + panel.child(UIComponents.spacer()); + + FlowLayout footer = UIContainers.horizontalFlow(Sizing.content(), Sizing.content()); + footer.verticalAlignment(VerticalAlignment.CENTER); + footer.horizontalAlignment(HorizontalAlignment.CENTER); + footer.gap(4); + + // eig hab ichs ja gemacht... egal mein name bleibt da + + var madeBy = UIComponents.label(Component.literal("made by fullrisk") + .withStyle(s -> s.withFont(new FontDescription.Resource(MC_FIVE)))) + .color(Color.ofRgb(0xB0B6C0)); + footer.child(madeBy); + + var heart = UIComponents.texture( + net.minecraft.resources.Identifier.fromNamespaceAndPath("minecraft", "textures/gui/sprites/hud/heart/full.png"), + 0, 0, 9, 9, 9, 9 + ); + footer.child(heart); + + panel.child(footer); + + panel.child(SettingsControls.makeTextButton(PANEL_SURFACE, "Back", () -> + Minecraft.getInstance().setScreen(new MainUI()) + )); + + rootComponent.child(panel); + } + + @Override + public boolean isPauseScreen() { return false; } +} \ No newline at end of file diff --git a/src/main/java/de/fullrisk/citrusDev/UI/MainUI.java b/src/main/java/de/fullrisk/citrusDev/UI/MainUI.java index 3def889..c926a33 100644 --- a/src/main/java/de/fullrisk/citrusDev/UI/MainUI.java +++ b/src/main/java/de/fullrisk/citrusDev/UI/MainUI.java @@ -26,7 +26,7 @@ public class MainUI extends BaseOwoScreen { public static Surface DISABLED = buildDisabledSurface(); public static Surface FLAT = buildFlatSurface(); - private static Surface buildPanelSurface() { + static Surface buildPanelSurface() { float blur = Config.get().panelBlur; int fill = Config.get().darkMode ? 0x601c1c1c : 0x40FFFFFF; if (blur <= 0f) return Surface.flat(fill).and(Surface.outline(0x64de4b)); @@ -60,6 +60,8 @@ public class MainUI extends BaseOwoScreen { private static int bright() { return 0xFFFFFF; } private static int tabText() { return 0xCCCCCC; } + //sowwwy wenn sich das wer anschaut, ik ist hässlich aber kann man nix machen + public static final int PANEL_WIDTH = 320; public static final int PANEL_HEIGHT = 190; public static final int INNER_WIDTH = PANEL_WIDTH - 4; @@ -128,6 +130,10 @@ public class MainUI extends BaseOwoScreen { var logo = UIComponents.texture(Identifier.fromNamespaceAndPath("citrus-dev", "textures/icons/citrus-logo.png"), 0, 0, 30, 30, 30, 30); logo.positioning(Positioning.absolute(4, (NAVBAR_HEIGHT - 30) / 2)); + logo.mouseDown().subscribe((click, doubled) -> { + Minecraft.getInstance().setScreen(new CreditsScreen()); + return true; + }); navbar.child(logo); for (TabDef tab : List.of( @@ -211,6 +217,8 @@ public class MainUI extends BaseOwoScreen { private static int sidebarBtnOutline() { return Config.get().darkMode ? 0xFF888888 : 0xFFFFFFFF; } private static int sidebarBtnHoverOutline() { return Config.get().darkMode ? 0xFFcccccc : 0xFFFFFFFF; } + // 3h für darkmode btw (ich hasse mein leben) + private FlowLayout buildSidebar() { FlowLayout sidebar = UIContainers.verticalFlow(Sizing.fixed(SIDEBAR_WIDTH), Sizing.fixed(ROW_HEIGHT)); sidebar.horizontalAlignment(HorizontalAlignment.CENTER); @@ -240,6 +248,8 @@ public class MainUI extends BaseOwoScreen { return sidebar; } + // sorry awa i schär mi nd dass i des wo anders hin dua + private ScalableButton makeSidebarButton(String symbol, int animateDelay) { var button = new ScalableButton(Component.literal(symbol), btn -> Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK.value(), 2.0F, 2)), diff --git a/src/main/java/de/fullrisk/citrusDev/UIHelper/ModuleRows.java b/src/main/java/de/fullrisk/citrusDev/UIHelper/ModuleRows.java index 85ddf7f..965e068 100644 --- a/src/main/java/de/fullrisk/citrusDev/UIHelper/ModuleRows.java +++ b/src/main/java/de/fullrisk/citrusDev/UIHelper/ModuleRows.java @@ -52,7 +52,7 @@ public class ModuleRows { "Module Disabled", "KeyStrokes is now inactive")), entry("FPS", ModuleRow.build( GLASS_PANEL, DISABLED, FLAT, - Identifier.fromNamespaceAndPath("citrus-dev", "textures/icons/fps.png"), 18, 18, MC_FIVE, + Identifier.fromNamespaceAndPath("minecraft", "textures/item/clock_00.png"), 20, 20, MC_FIVE, "FPS", "Displays your FPS", toggleState(Module_FPS::isEnabled, Module_FPS::setEnabled), SETTINGS_ICON, () -> { Config.get().lastModule = "FPS"; Config.get().save(); openSettingsByKey.accept("FPS"); }, diff --git a/src/main/java/de/fullrisk/citrusDev/UIHelper/ModuleSettings.java b/src/main/java/de/fullrisk/citrusDev/UIHelper/ModuleSettings.java index afa0981..2528010 100644 --- a/src/main/java/de/fullrisk/citrusDev/UIHelper/ModuleSettings.java +++ b/src/main/java/de/fullrisk/citrusDev/UIHelper/ModuleSettings.java @@ -43,7 +43,7 @@ public class ModuleSettings { return List.of( new SettingRow("Position", SettingsControls.makeCyclingButton(GLASS_PANEL, positionStates, positionIndex(Config.get().fpsX, Config.get().fpsY))), - new SettingRow("", SettingsControls.makeSectionHeader(CONTENT_WIDTH - 8, "Display Options")), + new SettingRow("", SettingsControls.makeSectionHeader(CONTENT_WIDTH - 8, "Visual")), new SettingRow("Padding", paddingSlider) ); } @@ -109,6 +109,7 @@ public class ModuleSettings { return List.of( new SettingRow("Position", SettingsControls.makeCyclingButton(GLASS_PANEL, positionStates, positionIndex(Config.get().effectsX, Config.get().effectsY))), + new SettingRow("", SettingsControls.makeSectionHeader(CONTENT_WIDTH - 8, "Visual")), new SettingRow("Show Background", SettingsControls.makeCheckbox(FLAT, GLASS_PANEL, Module_Effects.isBackgroundEnabled(), Module_Effects::setBackgroundEnabled)), new SettingRow("Show Timer", SettingsControls.makeCheckbox(FLAT, GLASS_PANEL, Module_Effects.isTimerEnabled(), Module_Effects::setTimerEnabled)), new SettingRow("Show Name", SettingsControls.makeCheckbox(FLAT, GLASS_PANEL, Module_Effects.isNameEnabled(), Module_Effects::setNameEnabled)) diff --git a/src/main/java/de/fullrisk/citrusDev/UIHelper/SettingsControls.java b/src/main/java/de/fullrisk/citrusDev/UIHelper/SettingsControls.java index 7d680db..01c13cd 100644 --- a/src/main/java/de/fullrisk/citrusDev/UIHelper/SettingsControls.java +++ b/src/main/java/de/fullrisk/citrusDev/UIHelper/SettingsControls.java @@ -24,7 +24,7 @@ public class SettingsControls { private static final Identifier MC_FIVE = Identifier.fromNamespaceAndPath("citrus-dev", "minecraft_five"); private static int secColor() { - return Config.get().darkMode ? 0xFFd0d4da : 0xFFb0b6c0; + return Config.get().darkMode ? 0xFF7a7979 : 0xFFb0b6c0; } public record ButtonState(String label, Runnable onSelect) {} @@ -194,19 +194,36 @@ public class SettingsControls { row.horizontalAlignment(HorizontalAlignment.LEFT); row.gap(4); - FlowLayout shortLine = UIContainers.horizontalFlow(Sizing.fixed(10), Sizing.fixed(1)); - shortLine.surface(Surface.flat(0x80FFFFFF)); - row.child(shortLine); + int shortLineWidth = 12; + row.child(makeDottedLine(0x90636363, shortLineWidth)); var label = UIComponents.label(Component.literal(text.toUpperCase()) .withStyle(style -> style.withFont(new FontDescription.Resource(MC_FIVE)))) .color(Color.ofRgb(secColor())); row.child(label); - FlowLayout longLine = UIContainers.horizontalFlow(Sizing.fill(100), Sizing.fixed(1)); - longLine.surface(Surface.flat(0x80FFFFFF)); - row.child(longLine); + int textWidth = Minecraft.getInstance().font.width(text.toUpperCase()); + int gapTotal = 4 + 4; // gap(4) appears twice: before label, after label + int longLineWidth = width - shortLineWidth - textWidth - gapTotal; + row.child(makeDottedLine(0x90636363, Math.max(longLineWidth, 20))); return row; } + + private static FlowLayout makeDottedLine(int color, int targetWidth) { + FlowLayout dotted = UIContainers.horizontalFlow(Sizing.fixed(targetWidth), Sizing.fixed(1)); + dotted.verticalAlignment(VerticalAlignment.CENTER); + dotted.gap(3); + + int segmentWidth = 3; + int segmentCount = Math.max(1, targetWidth / (segmentWidth + 3)); + + for (int i = 0; i < segmentCount; i++) { + FlowLayout dot = UIContainers.horizontalFlow(Sizing.fixed(segmentWidth), Sizing.fixed(1)); + dot.surface(Surface.flat(color)); + dotted.child(dot); + } + + return dotted; + } } \ No newline at end of file diff --git a/src/main/java/de/fullrisk/citrusDev/mixin/SliderComponentMixin.java b/src/main/java/de/fullrisk/citrusDev/mixin/SliderComponentMixin.java index 55ec066..a26cd4e 100644 --- a/src/main/java/de/fullrisk/citrusDev/mixin/SliderComponentMixin.java +++ b/src/main/java/de/fullrisk/citrusDev/mixin/SliderComponentMixin.java @@ -27,11 +27,15 @@ public abstract class SliderComponentMixin { OwoUIGraphics owo = OwoUIGraphics.of(graphics); - owo.fill(RenderPipelines.GUI, x, y, x + w, y + h, 0x40FFFFFF); + int trackHeight = Math.max(2, h / 3); + int trackY = y + (h - trackHeight) / 2; + owo.fill(RenderPipelines.GUI, x, trackY, x + w, trackY + trackHeight, 0x40FFFFFF); - int handleWidth = 4; + int handleWidth = 3; + int handleHeight = h; + int handleY = y + (h - handleHeight) / 2; int handleX = x + (int) (slider.value() * (w - handleWidth)); - owo.fill(RenderPipelines.GUI, handleX, y, handleX + handleWidth, y + h, 0xFFFFFFFF); + owo.fill(RenderPipelines.GUI, handleX, handleY, handleX + handleWidth, handleY + handleHeight, 0xFF64de4b); ci.cancel(); } diff --git a/src/main/resources/assets/citrus-dev/textures/icons/keystrokes.png b/src/main/resources/assets/citrus-dev/textures/icons/keystrokes.png index 50d91f7..cc737a1 100644 Binary files a/src/main/resources/assets/citrus-dev/textures/icons/keystrokes.png and b/src/main/resources/assets/citrus-dev/textures/icons/keystrokes.png differ