bonne planche de sprite

This commit is contained in:
Antoine 2021-06-17 20:42:16 +02:00
parent adfcf068e6
commit 0c24eea79f
2 changed files with 11 additions and 2 deletions

View File

@ -14,8 +14,14 @@ void main()
{ //Rectangle plus large que haut
vec4 colorTemp = color;
float ouverture = 0.8f;
// Effet "tube"
float lum = -pow(fragCoord.y + height/2f, 2f) * 5f /height + ouverture;
colorTemp.xyz *= lum;
// Effet flash sur la surface
float flash = abs(sin(time)) + 0.4f;
colorTemp.xyz *= flash;
if (leftToRight){
if (fill > fragCoord.x){
FragColor = colorTemp;

View File

@ -140,7 +140,7 @@ public class match {
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
boolean Joystick2Present = glfwJoystickPresent(GLFW_JOYSTICK_2);
String path = "textures/Sprite.png";
String path = "textures/Sprite_sans_grille_9comp.png";
String pathToBG = "textures/arena1.png";
ObjectGl background = new ObjectGl(0f,1f,1f,2.5f, pathToBG, null);
@ -182,7 +182,7 @@ public class match {
/*
GUI Setup
*/
coordP1 = new UIElementText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY(), 5f, 0f, 0.2f, 70f, engine);
coordP1 = new UIElementText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY(), 5f, 0f, 0.15f, 70f, engine);
coordP1.setBackground(new Vector3f(0f,0f,0f));
engine.add_uiElement(coordP1);
coordP2 = new UIElementText("objP2: " + objP2.getXPos() + ":" + objP2.getYPos() + " P1: " + p2.getPosX() +":" + p2.getPosY(), 5f, 0f, 0.1f, 70f, engine);
@ -192,6 +192,7 @@ public class match {
healthBarP1Obj = new HorizontalProgressBar(80f, 8.5f, 0.4f, 100f, p1.getCurrentHP(), p1.getMaxHP(), false);
healthBarP1Obj.setShader("shaders/StylishShaders/BasicNoTexVert.glsl", "shaders/StylishShaders/HorizontalProgressBarGradientSquareFrag.glsl");
healthBarP1Obj.setUseHeight(true);
healthBarP1Obj.useTime = true;
healthBarP1 = new UIElement(healthBarP1Obj, 0.0138f, 0.980f, engine);
healthBarP2Obj = new HorizontalProgressBar(80f, 8.5f, 0.4f, 100f, p2.getCurrentHP(), p2.getMaxHP(), true);
healthBarP2Obj.setColorVerticalGradient(new Vector3f(39f/255f, 201f/255f, 30f/255f), new Vector3f(19f/255f, 89f/255f, 15f/255f));
@ -219,6 +220,8 @@ public class match {
if(engine.shouldClose()) engine.setRunning(false);
}
engine.setRunning(false);
}