aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/gui
diff options
context:
space:
mode:
authornextdaydelivery <12willettsh@gmail.com>2022-02-20 12:13:58 +0000
committernextdaydelivery <12willettsh@gmail.com>2022-02-20 12:14:29 +0000
commitdfa65f6236c226eb88f4e3761e10e80e5f37c22b (patch)
tree33937f0cadf5fb012aae57e6db87e56a32b4e265 /src/main/java/io/polyfrost/oneconfig/gui
parent4f8e90571e3a270b54244d0fef985d5e0ca04b40 (diff)
downloadOneConfig-dfa65f6236c226eb88f4e3761e10e80e5f37c22b.tar.gz
OneConfig-dfa65f6236c226eb88f4e3761e10e80e5f37c22b.tar.bz2
OneConfig-dfa65f6236c226eb88f4e3761e10e80e5f37c22b.zip
package moves and a split string renderer
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/Window.java14
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/OCBlock.java11
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/OCStoreBlock.java18
3 files changed, 36 insertions, 7 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/Window.java b/src/main/java/io/polyfrost/oneconfig/gui/Window.java
index 8dd0138..7671578 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/Window.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/Window.java
@@ -1,13 +1,20 @@
package io.polyfrost.oneconfig.gui;
import io.polyfrost.oneconfig.gui.elements.OCBlock;
+import io.polyfrost.oneconfig.gui.elements.OCStoreBlock;
import io.polyfrost.oneconfig.themes.Theme;
-import io.polyfrost.oneconfig.themes.ThemeElement;
+import io.polyfrost.oneconfig.themes.textures.ThemeElement;
import io.polyfrost.oneconfig.themes.Themes;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.texture.DynamicTexture;
+import net.minecraft.util.ResourceLocation;
+import javax.imageio.ImageIO;
import java.awt.*;
+import java.io.IOException;
+import java.net.URL;
import static io.polyfrost.oneconfig.renderer.Renderer.clamp;
import static io.polyfrost.oneconfig.renderer.Renderer.easeOut;
@@ -18,6 +25,9 @@ public class Window extends GuiScreen {
private final Theme t = Themes.getActiveTheme();
private final int guiScaleToRestore;
OCBlock block = new OCBlock(-1, 100, 200);
+ ResourceLocation example = new ResourceLocation("oneconfig", "textures/hudsettings.png");
+ OCStoreBlock storeBlock = new OCStoreBlock("OneConfig Theme", "OneConfig default theme with the default look you love.", example, new Color(27,27,27,255).getRGB());
+ public static ScaledResolution resolution = new ScaledResolution(Minecraft.getMinecraft());
public Window() {
super.initGui();
@@ -31,6 +41,7 @@ public class Window extends GuiScreen {
}
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ resolution = new ScaledResolution(Minecraft.getMinecraft());
super.drawScreen(mouseX, mouseY, partialTicks);
currentProgress = clamp(easeOut(currentProgress, 1f));
int alphaVal = (int) (50 * currentProgress);
@@ -57,6 +68,7 @@ public class Window extends GuiScreen {
t.getTextureManager().draw(ThemeElement.BUTTON_OFF, left + 1424, top + 32, 64, 64);
t.getTextureManager().draw(ThemeElement.BUTTON_OFF, left + 1344, top + 32, 64, 64);
block.draw(200, 300);
+ storeBlock.draw(500,300);
//t.getTextureManager().draw(ThemeElement.CLOSE, left + 1504, top + 32, 64, 64);
//t.getTextureManager().draw(ThemeElement.BUTTON_OFF, left + 100, top + 100, 296, 64);
//t.getTextureManager().draw(ThemeElement.CLOSE);
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/OCBlock.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCBlock.java
index 7a5c8f3..fcce48b 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/OCBlock.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCBlock.java
@@ -2,7 +2,7 @@ package io.polyfrost.oneconfig.gui.elements;
import io.polyfrost.oneconfig.renderer.Renderer;
import io.polyfrost.oneconfig.themes.Theme;
-import io.polyfrost.oneconfig.themes.ThemeElement;
+import io.polyfrost.oneconfig.themes.textures.ThemeElement;
import io.polyfrost.oneconfig.themes.Themes;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
@@ -14,15 +14,16 @@ import org.lwjgl.input.Mouse;
import java.awt.*;
+import static io.polyfrost.oneconfig.gui.Window.resolution;
+
@SuppressWarnings("unused")
public class OCBlock {
- private static final Theme theme = Themes.getActiveTheme();
+ public static final Theme theme = Themes.getActiveTheme();
private static final Minecraft mc = Minecraft.getMinecraft();
- public static ScaledResolution resolution = new ScaledResolution(mc);
private Color color;
private String text;
private final boolean bold;
- private int width, height;
+ protected int width, height;
private ThemeElement element;
private boolean clicked = false;
private boolean rightClicked = false;
@@ -103,7 +104,7 @@ public class OCBlock {
}
/**
- * Update this elements click, key and hover status. Call this method at the end of your 'draw' function, if overrided.
+ * Update this elements click, key and hover status. Call this method at the end of your 'draw' function, if overridden.
*/
public void update() {
resolution = new ScaledResolution(mc);
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/OCStoreBlock.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCStoreBlock.java
index 6d9d8c1..7a87f77 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/OCStoreBlock.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/OCStoreBlock.java
@@ -1,17 +1,33 @@
package io.polyfrost.oneconfig.gui.elements;
+import io.polyfrost.oneconfig.renderer.Renderer;
import net.minecraft.util.ResourceLocation;
-public class OCStoreBlock extends OCBlock {
+import java.awt.*;
+public class OCStoreBlock extends OCBlock {
+ private ResourceLocation image;
+ private String description, title;
+ private Color color;
public OCStoreBlock(String title, String description, ResourceLocation image, int color) {
super(color, 200, 400);
+ this.color = Renderer.getColorFromInt(color);
+ this.description = description;
+ this.title = title;
+ this.image = image;
}
public void draw(int x, int y) {
+ super.draw(x, y);
+ Renderer.drawScaledImage(image, x, y, 200, 100);
+ super.theme.getFont().drawSplitString("i like fish", x + 2, y + 102, 200, -1);
super.update();
}
+
+ public void draw(int x, int y, int width, int height) {
+ draw(x,y);
+ }
}