summaryrefslogtreecommitdiff
path: root/src/main/java/net/tylermurphy/Minecraft/UI/UIImage.java
diff options
context:
space:
mode:
authorTyler Murphy <tylerm@tylerm.dev>2023-04-17 12:12:01 -0400
committerTyler Murphy <tylerm@tylerm.dev>2023-04-17 12:12:01 -0400
commit180aad05decc7eefa87e4e45d6747c48f40e5361 (patch)
tree51545197f7c94b4022acab880772c9f4fc65db0e /src/main/java/net/tylermurphy/Minecraft/UI/UIImage.java
downloadminecraftjava-180aad05decc7eefa87e4e45d6747c48f40e5361.tar.gz
minecraftjava-180aad05decc7eefa87e4e45d6747c48f40e5361.tar.bz2
minecraftjava-180aad05decc7eefa87e4e45d6747c48f40e5361.zip
save
Diffstat (limited to '')
-rwxr-xr-xsrc/main/java/net/tylermurphy/Minecraft/UI/UIImage.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/net/tylermurphy/Minecraft/UI/UIImage.java b/src/main/java/net/tylermurphy/Minecraft/UI/UIImage.java
new file mode 100755
index 0000000..7e772ab
--- /dev/null
+++ b/src/main/java/net/tylermurphy/Minecraft/UI/UIImage.java
@@ -0,0 +1,30 @@
+package net.tylermurphy.Minecraft.UI;
+
+import org.joml.Vector2f;
+
+import net.tylermurphy.Minecraft.Render.Data.Display;
+
+public class UIImage extends UIComponent {
+
+ private int texture;
+
+ public void setTexture(int texture) {
+ this.texture = texture;
+ }
+
+ public int getTexture() {
+ return texture;
+ }
+
+ public boolean clicked() {
+ Vector2f pos = Display.getCursorPos();
+ float x1 = super.getConvertedPosition().x*Display.getWidth();
+ float y1 = super.getConvertedPosition().y*Display.getHeight();
+ float x2 = super.getConvertedPosition().x*Display.getWidth()+super.getConvertedSize().x*Display.getWidth();
+ float y2 = super.getConvertedPosition().y*Display.getHeight()+super.getConvertedSize().y*Display.getHeight();
+ if(pos.x >= x1 && pos.x <= x2 && pos.y >= y1 && pos.y <= y2)
+ return true;
+ return false;
+ }
+
+}