From 57c8c042a671d2109cab6bea76fb51f713aaf620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Wed, 17 Jun 2015 01:22:07 +0200 Subject: [PATCH] fix: correction bogue viewport sur lasers --- core/src/fr/evolving/effects/Laser.java | 5 ++--- core/src/fr/evolving/worlds/LevelRenderer.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/fr/evolving/effects/Laser.java b/core/src/fr/evolving/effects/Laser.java index a22849e..caa7746 100644 --- a/core/src/fr/evolving/effects/Laser.java +++ b/core/src/fr/evolving/effects/Laser.java @@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture.TextureFilter; import com.badlogic.gdx.graphics.Texture.TextureWrap; +import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; @@ -29,11 +30,10 @@ public class Laser { overlay=AssetLoader.Skin_level.getAtlas().findRegion("overlay"); } - public void draw(float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) { + public void draw(Batch Laser,float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) { Vector2 vectorall = new Vector2(x2, y2).sub(new Vector2(x1, y1)); float length = vectorall.len(); Vector2 vectoradd = vectorall.scl(10/length); - SpriteBatch Laser=new SpriteBatch(); Laser.begin(); Laser.setColor(colorsrc); Laser.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE); @@ -43,7 +43,6 @@ public class Laser { Laser.draw(overlay,x1+i*vectoradd.x,y1+i*vectoradd.y,32,0,64,Calcul.getLen(x1+i*vectoradd.x,y1+i*vectoradd.y,x2,y2),1f,1f,(float)Math.toDegrees(Calcul.getAngle(x1,y1,x2,y2))); Laser.draw(overlay,x1,y1,32,0,64,Calcul.getLen(x1+i*vectoradd.x,y1+i*vectoradd.y,x2,y2),1f,1f,(float)Math.toDegrees(Calcul.getAngle(x1,y1,x2,y2))); Laser.end(); - Laser.dispose(); } public void drawnotsoold(float x1,float y1,float x2,float y2,float maxwidth,float power,boolean active,Color colorsrc,Color colordst) { diff --git a/core/src/fr/evolving/worlds/LevelRenderer.java b/core/src/fr/evolving/worlds/LevelRenderer.java index 499f084..49f86b5 100644 --- a/core/src/fr/evolving/worlds/LevelRenderer.java +++ b/core/src/fr/evolving/worlds/LevelRenderer.java @@ -105,7 +105,7 @@ public class LevelRenderer { } if (found!=-1) { - Laser.draw(LevelScreen.buttonLevels[i].level.X+20,LevelScreen.buttonLevels[i].level.Y+20,LevelScreen.buttonLevels[found].level.X+20,LevelScreen.buttonLevels[found].level.Y+20,10,0.5f,LevelScreen.buttonLevels[found].Activated,LevelScreen.buttonLevels[i].getLevelcolor(),LevelScreen.buttonLevels[found].getLevelcolor()); + Laser.draw(batcher,LevelScreen.buttonLevels[i].level.X+20,LevelScreen.buttonLevels[i].level.Y+20,LevelScreen.buttonLevels[found].level.X+20,LevelScreen.buttonLevels[found].level.Y+20,10,0.5f,LevelScreen.buttonLevels[found].Activated,LevelScreen.buttonLevels[i].getLevelcolor(),LevelScreen.buttonLevels[found].getLevelcolor()); } } }