Show boundingbox info/debug with 'o'
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package main;
|
package main;
|
||||||
|
|
||||||
import ea.Game;
|
import ea.Game;
|
||||||
|
import ea.Taste;
|
||||||
import main.HUD.HUD;
|
import main.HUD.HUD;
|
||||||
import main.worlds.TestWorld;
|
import main.worlds.TestWorld;
|
||||||
import main.worlds.World;
|
import main.worlds.World;
|
||||||
@@ -11,6 +12,7 @@ import main.worlds.World;
|
|||||||
public class Main extends Game {
|
public class Main extends Game {
|
||||||
|
|
||||||
public static Main instance;
|
public static Main instance;
|
||||||
|
public static boolean SHOW_DEBUG = false;
|
||||||
|
|
||||||
private World world;
|
private World world;
|
||||||
private HUD hud;
|
private HUD hud;
|
||||||
@@ -33,6 +35,9 @@ public class Main extends Game {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tasteReagieren(int code) {
|
public void tasteReagieren(int code) {
|
||||||
|
if (code == Taste.O) {
|
||||||
|
SHOW_DEBUG = !SHOW_DEBUG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
|
|||||||
@@ -37,11 +37,14 @@ public abstract class AnimatedEntity extends Entity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void zeichnen(Graphics2D g, BoundingRechteck r) {
|
public void zeichnen(Graphics2D g, BoundingRechteck r) {
|
||||||
g.setColor(Color.GREEN);
|
if (Main.SHOW_DEBUG) {
|
||||||
|
g.setColor(Color.CYAN);
|
||||||
g.drawRect((int) actionFigur.positionX(), (int) actionFigur.positionY(),
|
g.drawRect((int) actionFigur.positionX(), (int) actionFigur.positionY(),
|
||||||
(int) actionFigur.getBreite(), (int) actionFigur.getHoehe());
|
(int) actionFigur.getBreite(), (int) actionFigur.getHoehe());
|
||||||
|
g.setColor(Color.GREEN);
|
||||||
g.drawRect((int) ((posX - width / 2) * World.SCALE), (int) ((posY - height / 2) * World.SCALE),
|
g.drawRect((int) ((posX - width / 2) * World.SCALE), (int) ((posY - height / 2) * World.SCALE),
|
||||||
(int) (width * World.SCALE), (int) (height * World.SCALE));
|
(int) (width * World.SCALE), (int) (height * World.SCALE));
|
||||||
|
}
|
||||||
super.zeichnen(g, r);
|
super.zeichnen(g, r);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -62,7 +65,7 @@ public abstract class AnimatedEntity extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spiegelt die figur autmatisch, wenn n<EFBFBD>tig.
|
* Spiegelt die figur autmatisch, wenn nötig.
|
||||||
*/
|
*/
|
||||||
protected void zustandSetzen(String name) {
|
protected void zustandSetzen(String name) {
|
||||||
actionFigur.spiegelXSetzen(side);
|
actionFigur.spiegelXSetzen(side);
|
||||||
|
|||||||
Reference in New Issue
Block a user