Montre les coordonnées

This commit is contained in:
Antoine 2021-06-16 13:48:52 +02:00
parent 467086b3ba
commit cbec6fba9d
3 changed files with 22 additions and 4 deletions

View File

@ -15,12 +15,12 @@ void main(){
flash = sin(flash + time * 15);
flash = mix(flash, color, 0.5f);
flash.a = 1f;
vec4 tex = texture(texture1, texCoord);
if (tex.a == 0.0){
if (tex.a == 0.0 || (flash.x+ flash.y + flash.z)/3 <= (tex.x+ tex.y + tex.z)/3){
FragColor = tex;
} else{
FragColor = mix(tex, flash, 0.3f);
FragColor.a = 1.0f;
}
}

View File

@ -49,7 +49,7 @@ public class TestEngine {
ObjectGl zangief = new Sprite(10.0f, 10f, path, null);
zangief.setTextureWrap(58, 0, 62, 84);
engine.add_objectGl(zangief);
zangief.translate(new Vector3f(-1000.0f, 200.0f, 0.0f));
zangief.translate(new Vector3f(-750.0f, 200.0f, 0.0f));
zangief.setColor(new Vector3f(1.0f, 1.0f, 1.0f));
zangief.setShader("shaders/StylishShaders/BasicVert.glsl", "shaders/StylishShaders/FlashFrag.glsl");
zangief.useTime = true;
@ -57,9 +57,13 @@ public class TestEngine {
ObjectGl zangief2 = new Sprite(9.0f, 10f, path, null);
zangief2.setTextureWrap(58, 0, 62, 84);
engine.add_objectGl(zangief2);
zangief2.translate(new Vector3f(1000.0f, 200.0f, 0.0f));
zangief2.translate(new Vector3f(500.0f, 200.0f, 0.0f));
zangief2.flipTextureWrapH();
ObjectGl shaderTestSubject = new ObjectGl(24f, 10f, 10f, 100f, null, null);
shaderTestSubject.translate(new Vector3f(-200f, 400f, 0f));
engine.add_objectGl(shaderTestSubject);
// Hitbox hitboxTest = new Hitbox(35.0f, 100.0f, 50.0f, 10.0f, new Vector3f(1.0f, 0.0f, 0.0f));
// engine.add_objectGl(hitboxTest);

View File

@ -1,6 +1,7 @@
package gameplay.match;
import engine.Engine;
import engine.gui.UIElementText;
import engine.input.Button;
import engine.input.GamepadInput;
import engine.math.Vector3f;
@ -58,6 +59,10 @@ public class match {
private static GamepadInput gamepad1 = null;
private static GamepadInput gamepad2 = null;
// GUI
private static UIElementText coordP1;
private static UIElementText coordP2;
private static ObjectGl objP1,objP2;
private static Engine engine;
private static Frame f;
@ -135,6 +140,12 @@ public class match {
System.out.println("P2 Controller: " + gamepad2.getGamepadName());
}
// GUI setup
coordP1 = new UIElementText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY(), 5f, 0f, 1f, 80f, engine);
engine.add_uiElement(coordP1);
coordP2 = new UIElementText("objP2: " + objP2.getXPos() + ":" + objP2.getYPos() + " P1: " + p2.getPosX() +":" + p2.getPosY(), 5f, 0f, 0.9f, 80f, engine);
engine.add_uiElement(coordP2);
while(frameCount < 5940 && engine.getRunning()) {
ac(acCode);
if(engine.shouldClose()) engine.setRunning(false);
@ -272,6 +283,9 @@ public class match {
//Waits the end of 1/60th of a second since start of frame then loops back to start
case 23:
// GUI update here
coordP1.setText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY());
coordP2.setText("objP2: " + objP2.getXPos() + ":" + objP2.getYPos() + " P2: " + p2.getPosX() +":" + p2.getPosY());
timeStamp2 = System.currentTimeMillis();
while(timeStamp2-timeStamp1<(1000/60)) {
timeStamp2 = System.currentTimeMillis();