added some textures for ui

pull/1/head
hYdos 2019-06-01 13:23:49 +10:00
parent e33abee5d7
commit c866cacb4e
38 changed files with 113 additions and 28 deletions

View File

@ -4,14 +4,14 @@ import java.util.ArrayList;
import java.util.List;
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
import io.github.hydos.ginger.engine.elements.Entity;
import io.github.hydos.ginger.engine.elements.Light;
import io.github.hydos.ginger.engine.elements.Player;
import io.github.hydos.ginger.engine.elements.buttons.TextureButton;
import io.github.hydos.ginger.engine.elements.buttons.GuiTexture;
import io.github.hydos.ginger.engine.elements.objects.Entity;
import io.github.hydos.ginger.engine.elements.objects.Light;
import io.github.hydos.ginger.engine.elements.objects.Player;
import io.github.hydos.ginger.engine.font.FontType;
import io.github.hydos.ginger.engine.font.GUIText;
import io.github.hydos.ginger.engine.font.TextMaster;
import io.github.hydos.ginger.engine.guis.GuiTexture;
import io.github.hydos.ginger.engine.guis.buttons.Button;
import io.github.hydos.ginger.engine.io.Window;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector2f;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector3f;
@ -133,7 +133,7 @@ public class Example {
ParticleTexture particleTexture = new ParticleTexture(Loader.loadTexture("particles/smoke.png"), 8);
Button button = new Button("/textures/guis/ginger.png", new Vector2f(0.8f, 0), new Vector2f(0.1f, 0.1f));
TextureButton button = new TextureButton("/textures/guis/ginger.png", new Vector2f(0.8f, 0), new Vector2f(0.1f, 0.1f));
button.show(guis);
ParticleSystem system = new ParticleSystem(particleTexture, 100, 10f, 0.3f, 4, 3f);
system.randomizeRotation();

View File

@ -3,7 +3,7 @@ package io.github.hydos.ginger.engine.cameras;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.glfw.GLFWScrollCallback;
import io.github.hydos.ginger.engine.elements.Player;
import io.github.hydos.ginger.engine.elements.objects.Player;
import io.github.hydos.ginger.engine.io.Window;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector3f;

View File

@ -1,4 +1,4 @@
package io.github.hydos.ginger.engine.guis;
package io.github.hydos.ginger.engine.elements.buttons;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector2f;

View File

@ -1,15 +1,14 @@
package io.github.hydos.ginger.engine.guis.buttons;
package io.github.hydos.ginger.engine.elements.buttons;
import java.util.List;
import org.lwjgl.glfw.GLFW;
import io.github.hydos.ginger.engine.guis.GuiTexture;
import io.github.hydos.ginger.engine.io.Window;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector2f;
import io.github.hydos.ginger.engine.utils.Loader;
public class Button{
public class TextureAndTextButton{
private GuiTexture guiTexture;
@ -19,7 +18,7 @@ public class Button{
private boolean isHovering = false;
public Button(String texture, Vector2f position, Vector2f scale) {
public TextureAndTextButton(String texture, Vector2f position, Vector2f scale) {
guiTexture = new GuiTexture(Loader.loadTextureDirectly(texture), position, scale);
}

View File

@ -0,0 +1,86 @@
package io.github.hydos.ginger.engine.elements.buttons;
import java.util.List;
import org.lwjgl.glfw.GLFW;
import io.github.hydos.ginger.engine.io.Window;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector2f;
import io.github.hydos.ginger.engine.utils.Loader;
public class TextureButton{
private GuiTexture guiTexture;
private boolean shown = false;
private boolean clicked = false;
private boolean isHovering = false;
public TextureButton(String texture, Vector2f position, Vector2f scale) {
guiTexture = new GuiTexture(Loader.loadTextureDirectly(texture), position, scale);
}
public void update() {
if(shown) {
Vector2f location = guiTexture.getPosition();
Vector2f scale = guiTexture.getScale();
Vector2f mouseCoords = Window.getNormalizedMouseCoordinates();
if(location.y + scale.y > -mouseCoords.y && location.y - scale.y < -mouseCoords.y && location.x + scale.x > mouseCoords.x && location.x - scale.x < mouseCoords.x) {
isHovering = true;
if(Window.isMousePressed(GLFW.GLFW_MOUSE_BUTTON_1)) {
clicked = true;
}else {
clicked = false;
}
}else {
if(isHovering) {
isHovering = false;
}
}
}else {
isHovering = false;
clicked = false;
}
}
public void show(List<GuiTexture> guiTexture) {
if(shown) {
}else {
guiTexture.add(this.guiTexture);
this.shown = true;
}
}
public void hide(List<GuiTexture> guiTexture) {
if(!shown) {
}else {
guiTexture.remove(this.guiTexture);
this.shown = false;
}
}
public boolean isShown() {
return shown;
}
public boolean isClicked() {
return clicked;
}
public boolean isHovering() {
return isHovering;
}
}

View File

@ -1,4 +1,4 @@
package io.github.hydos.ginger.engine.elements;
package io.github.hydos.ginger.engine.elements.objects;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector3f;
import io.github.hydos.ginger.engine.renderEngine.models.TexturedModel;

View File

@ -1,4 +1,4 @@
package io.github.hydos.ginger.engine.elements;
package io.github.hydos.ginger.engine.elements.objects;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector3f;

View File

@ -1,4 +1,4 @@
package io.github.hydos.ginger.engine.elements;
package io.github.hydos.ginger.engine.elements.objects;
import org.lwjgl.glfw.GLFW;

View File

@ -9,9 +9,9 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
import io.github.hydos.ginger.engine.elements.Entity;
import io.github.hydos.ginger.engine.elements.Light;
import io.github.hydos.ginger.engine.guis.GuiTexture;
import io.github.hydos.ginger.engine.elements.buttons.GuiTexture;
import io.github.hydos.ginger.engine.elements.objects.Entity;
import io.github.hydos.ginger.engine.elements.objects.Light;
import io.github.hydos.ginger.engine.io.Window;
import io.github.hydos.ginger.engine.mathEngine.matrixes.Matrix4f;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector4f;

View File

@ -8,7 +8,7 @@ import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
import io.github.hydos.ginger.engine.elements.Entity;
import io.github.hydos.ginger.engine.elements.objects.Entity;
import io.github.hydos.ginger.engine.mathEngine.Maths;
import io.github.hydos.ginger.engine.mathEngine.matrixes.Matrix4f;
import io.github.hydos.ginger.engine.renderEngine.MasterRenderer;

View File

@ -7,7 +7,7 @@ import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
import io.github.hydos.ginger.engine.guis.GuiTexture;
import io.github.hydos.ginger.engine.elements.buttons.GuiTexture;
import io.github.hydos.ginger.engine.mathEngine.Maths;
import io.github.hydos.ginger.engine.mathEngine.matrixes.Matrix4f;
import io.github.hydos.ginger.engine.renderEngine.models.RawModel;

View File

@ -9,8 +9,8 @@ import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
import io.github.hydos.ginger.engine.elements.Entity;
import io.github.hydos.ginger.engine.elements.Light;
import io.github.hydos.ginger.engine.elements.objects.Entity;
import io.github.hydos.ginger.engine.elements.objects.Light;
import io.github.hydos.ginger.engine.io.Window;
import io.github.hydos.ginger.engine.mathEngine.Maths;
import io.github.hydos.ginger.engine.mathEngine.matrixes.Matrix4f;

View File

@ -2,7 +2,7 @@ package io.github.hydos.ginger.engine.renderEngine.shaders;
import java.util.List;
import io.github.hydos.ginger.engine.elements.Light;
import io.github.hydos.ginger.engine.elements.objects.Light;
import io.github.hydos.ginger.engine.mathEngine.matrixes.Matrix4f;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector2f;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector3f;

View File

@ -3,7 +3,7 @@ package io.github.hydos.ginger.engine.renderEngine.shaders;
import java.util.List;
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
import io.github.hydos.ginger.engine.elements.Light;
import io.github.hydos.ginger.engine.elements.objects.Light;
import io.github.hydos.ginger.engine.mathEngine.Maths;
import io.github.hydos.ginger.engine.mathEngine.matrixes.Matrix4f;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector3f;

View File

@ -3,7 +3,7 @@ package io.github.hydos.ginger.engine.renderEngine.shaders;
import java.util.List;
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
import io.github.hydos.ginger.engine.elements.Light;
import io.github.hydos.ginger.engine.elements.objects.Light;
import io.github.hydos.ginger.engine.mathEngine.Maths;
import io.github.hydos.ginger.engine.mathEngine.matrixes.Matrix4f;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector3f;

View File

@ -8,7 +8,7 @@ import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
import io.github.hydos.ginger.engine.elements.Entity;
import io.github.hydos.ginger.engine.elements.objects.Entity;
import io.github.hydos.ginger.engine.mathEngine.Maths;
import io.github.hydos.ginger.engine.mathEngine.matrixes.Matrix4f;
import io.github.hydos.ginger.engine.renderEngine.MasterRenderer;

View File

@ -6,8 +6,8 @@ import java.util.Map;
import org.lwjgl.opengl.GL11;
import io.github.hydos.ginger.engine.cameras.ThirdPersonCamera;
import io.github.hydos.ginger.engine.elements.Entity;
import io.github.hydos.ginger.engine.elements.Light;
import io.github.hydos.ginger.engine.elements.objects.Entity;
import io.github.hydos.ginger.engine.elements.objects.Light;
import io.github.hydos.ginger.engine.mathEngine.matrixes.Matrix4f;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector2f;
import io.github.hydos.ginger.engine.mathEngine.vectors.Vector3f;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB