added gradle wrapper and other stuff
@@ -2,7 +2,9 @@ package org.saturnclient.saturnclient.menus;
|
||||
|
||||
import org.saturnclient.ui.SaturnAnimation;
|
||||
import org.saturnclient.ui.SaturnUi;
|
||||
import org.saturnclient.ui.Textures;
|
||||
import org.saturnclient.ui.widgets.SaturnButton;
|
||||
import org.saturnclient.ui.widgets.SaturnImageButton;
|
||||
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
@@ -13,9 +15,36 @@ public class MainMenu extends SaturnUi {
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
int buttonWidth = 96;
|
||||
int buttonHeight = 25;
|
||||
|
||||
draw(
|
||||
new SaturnButton("Settings", () -> {
|
||||
client.setScreen(new SettingsMenu());
|
||||
}).setX(10).setY(10).setWidth(96).setHeight(25).setAnimation(SaturnAnimation.FADE_SLIDE.distance(15)));
|
||||
}).setX((width - buttonWidth) / 2).setY((height - buttonHeight) / 2).setWidth(buttonWidth)
|
||||
.setHeight(buttonHeight)
|
||||
.setAnimation(SaturnAnimation.FADE_SLIDE.distance(15)));
|
||||
|
||||
draw(
|
||||
new SaturnImageButton(Textures.EMOTE, 14, 14,
|
||||
() -> {
|
||||
client.setScreen(new SettingsMenu());
|
||||
})
|
||||
.setX((width - buttonWidth - (buttonHeight * 2) - 6) / 2)
|
||||
.setY((height - buttonHeight) / 2)
|
||||
.setWidth(buttonHeight)
|
||||
.setHeight(buttonHeight)
|
||||
.setAnimation(SaturnAnimation.FADE_SLIDE.distance(15)));
|
||||
|
||||
draw(
|
||||
new SaturnImageButton(Textures.COSMETICS, 14, 14,
|
||||
() -> {
|
||||
client.setScreen(new SettingsMenu());
|
||||
})
|
||||
.setX((width / 2) + (buttonWidth / 2) + 3)
|
||||
.setY((height - buttonHeight) / 2)
|
||||
.setWidth(buttonHeight)
|
||||
.setHeight(buttonHeight)
|
||||
.setAnimation(SaturnAnimation.FADE_SLIDE.distance(15)));
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,13 @@
|
||||
package org.saturnclient.saturnclient.menus;
|
||||
|
||||
import org.saturnclient.ui.SaturnUi;
|
||||
import org.saturnclient.ui.Textures;
|
||||
import org.saturnclient.ui.widgets.SaturnImageButton;
|
||||
import org.saturnclient.ui.widgets.SaturnInputBox;
|
||||
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class SettingsMenu extends SaturnUi {
|
||||
public static Identifier searchTexture = Identifier.of("saturnclient", "textures/gui/components/search.png");
|
||||
public static Identifier closeTexture = Identifier.of("saturnclient", "textures/gui/components/close.png");
|
||||
public SaturnImageButton searchButton;
|
||||
public SaturnInputBox searchInputBox;
|
||||
|
||||
@@ -23,15 +21,15 @@ public class SettingsMenu extends SaturnUi {
|
||||
searchInputBox.visible = false;
|
||||
draw(searchInputBox);
|
||||
|
||||
searchButton = (SaturnImageButton) new SaturnImageButton(searchTexture, 10,
|
||||
searchButton = (SaturnImageButton) new SaturnImageButton(Textures.SEARCH, 10,
|
||||
10,
|
||||
() -> {
|
||||
searchInputBox.visible = !searchInputBox.visible;
|
||||
if (searchInputBox.visible) {
|
||||
searchButton.sprite = closeTexture;
|
||||
searchButton.sprite = Textures.CLOSE;
|
||||
} else {
|
||||
searchInputBox.clearText();
|
||||
searchButton.sprite = searchTexture;
|
||||
searchButton.sprite = Textures.SEARCH;
|
||||
}
|
||||
}).setWidth(30).setHeight(30).setX(30).setY(30);
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ public class SaturnUi extends Screen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(context, mouseX, mouseY, delta);
|
||||
|
||||
for (SaturnWidget widget : new ArrayList<>(widgets)) {
|
||||
if (!widget.visible) {
|
||||
continue;
|
||||
|
||||
@@ -3,14 +3,14 @@ package org.saturnclient.ui;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
|
||||
public class SaturnWidget {
|
||||
public int x;
|
||||
public int y;
|
||||
public int width;
|
||||
public int height;
|
||||
public int x = 0;
|
||||
public int y = 0;
|
||||
public int width = 0;
|
||||
public int height = 0;
|
||||
public float alpha = 1.0f;
|
||||
public SaturnAnimation animation = null;
|
||||
public boolean visible = true;
|
||||
|
||||
|
||||
public void render(DrawContext context, boolean hovering) {
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.saturnclient.ui;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class Textures {
|
||||
public static final Identifier SETTINGS = Identifier.of("saturnclient", "textures/gui/components/settings.png");
|
||||
public static final Identifier COSMETICS = Identifier.of("saturnclient", "textures/gui/components/cosmetics.png");
|
||||
public static final Identifier EMOTE = Identifier.of("saturnclient", "textures/gui/components/emote.png");
|
||||
public static final Identifier SEARCH = Identifier.of("saturnclient", "textures/gui/components/search.png");
|
||||
public static final Identifier CLOSE = Identifier.of("saturnclient", "textures/gui/components/close.png");
|
||||
|
||||
// Button Textures
|
||||
public static final Identifier BUTTON_BORDER = Identifier.ofVanilla("widget/saturn/button_border");
|
||||
public static final Identifier BUTTON = Identifier.ofVanilla("widget/saturn/button");
|
||||
}
|
||||
@@ -1,21 +1,18 @@
|
||||
package org.saturnclient.ui.widgets;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.saturnclient.ui.SaturnWidget;
|
||||
import org.saturnclient.ui.Textures;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ButtonTextures;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class SaturnButton extends SaturnWidget {
|
||||
public static final Identifier BORDER_TEXTURE = Identifier.ofVanilla("widget/saturn/button_border");
|
||||
public static final ButtonTextures TEXTURES = new ButtonTextures(
|
||||
Identifier.ofVanilla("widget/saturn/button"), Identifier.ofVanilla("widget/saturn/button_disabled"),
|
||||
Identifier.ofVanilla("widget/saturn/button"));
|
||||
|
||||
public boolean active = true;
|
||||
public String text;
|
||||
public Runnable onPress;
|
||||
@@ -29,18 +26,21 @@ public class SaturnButton extends SaturnWidget {
|
||||
public void render(DrawContext context, boolean hovering) {
|
||||
MinecraftClient minecraftClient = MinecraftClient.getInstance();
|
||||
|
||||
context.drawGuiTexture(RenderLayer::getGuiTextured, TEXTURES.get(this.active, hovering), this.x,
|
||||
RenderSystem.setShaderTexture(0, Textures.BUTTON);
|
||||
RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
|
||||
|
||||
context.drawGuiTexture(RenderLayer::getGuiTextured, Textures.BUTTON, this.x,
|
||||
this.y, this.width, this.height, ColorHelper.getWhite(this.alpha));
|
||||
|
||||
if (hovering) {
|
||||
context.drawGuiTexture(RenderLayer::getGuiTextured, BORDER_TEXTURE, this.x,
|
||||
context.drawGuiTexture(RenderLayer::getGuiTextured, Textures.BUTTON_BORDER, this.x,
|
||||
this.y, this.width, this.height, ColorHelper.getArgb(255, 251, 60, 79));
|
||||
}
|
||||
|
||||
int i = this.active ? 16777215 : 10526880;
|
||||
context.drawText(minecraftClient.textRenderer, this.text,
|
||||
this.x + ((this.width - minecraftClient.textRenderer.getWidth(this.text)) / 2),
|
||||
this.y + ((this.height - 7) / 2),
|
||||
this.y + ((this.height - minecraftClient.textRenderer.fontHeight + 1) / 2),
|
||||
i | MathHelper.ceil(this.alpha * 255.0F) << 24, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ public class SaturnImageButton extends SaturnButton {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, boolean hovering) {
|
||||
context.drawGuiTexture(RenderLayer::getGuiTextured, SaturnButton.TEXTURES.get(this.active, hovering), this.x,
|
||||
this.y, this.width, this.height, ColorHelper.getWhite(this.alpha));
|
||||
super.render(context, hovering);
|
||||
|
||||
context.drawTexture(RenderLayer::getGuiTextured, sprite, x + (width - imageWidth) / 2,
|
||||
y + (height - imageHeight) / 2, 0, 0, imageWidth, imageHeight, imageWidth,
|
||||
|
||||
@@ -2,17 +2,15 @@ package org.saturnclient.ui.widgets;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.saturnclient.ui.SaturnWidget;
|
||||
import org.saturnclient.ui.Textures;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
|
||||
public class SaturnInputBox extends SaturnWidget {
|
||||
public static final Identifier TEXTURE = Identifier.ofVanilla("widget/saturn/button");
|
||||
|
||||
public String text = "";
|
||||
public String placeholder = "";
|
||||
public int cursorPosition = 0;
|
||||
@@ -64,7 +62,7 @@ public class SaturnInputBox extends SaturnWidget {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, boolean hovering) {
|
||||
context.drawGuiTexture(RenderLayer::getGuiTextured, TEXTURE, this.x,
|
||||
context.drawGuiTexture(RenderLayer::getGuiTextured, Textures.BUTTON, this.x,
|
||||
this.y, this.width, this.height, ColorHelper.getWhite(this.alpha));
|
||||
|
||||
int scrollOffset = getScrollOffset();
|
||||
|
||||
|
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 391 B |
@@ -4,7 +4,7 @@
|
||||
"type": "nine_slice",
|
||||
"width": 80,
|
||||
"height": 80,
|
||||
"border": 15
|
||||
"border": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 650 B After Width: | Height: | Size: 421 B |
@@ -4,7 +4,7 @@
|
||||
"type": "nine_slice",
|
||||
"width": 80,
|
||||
"height": 80,
|
||||
"border": 15
|
||||
"border": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 494 B |
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"gui": {
|
||||
"scaling": {
|
||||
"type": "nine_slice",
|
||||
"width": 300,
|
||||
"height": 30,
|
||||
"border": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 494 B |
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"gui": {
|
||||
"scaling": {
|
||||
"type": "nine_slice",
|
||||
"width": 300,
|
||||
"height": 30,
|
||||
"border": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 455 B |
|
After Width: | Height: | Size: 619 B |