diff --git a/core/src/com/monjaro/gamejam/Game.java b/core/src/com/monjaro/gamejam/Game.java index acf2641..d83d1d5 100644 --- a/core/src/com/monjaro/gamejam/Game.java +++ b/core/src/com/monjaro/gamejam/Game.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.utils.ScreenUtils; import com.monjaro.gamejam.segment.DualSegment; @@ -23,6 +24,7 @@ public class Game extends ApplicationAdapter { private final List segments = new ArrayList<>(); private SpriteBatch batch; + private BitmapFont font; private Texture img; private final static int TICKS_PER_SECOND = 60; @@ -31,6 +33,8 @@ public class Game extends ApplicationAdapter { @Override public void create() { batch = new SpriteBatch(); + font = new BitmapFont(); + font.getData().markupEnabled = true; img = new Texture("badlogic.jpg"); Face.setBlankFaceSprite(new Texture("blank_die_face.png")); @@ -65,7 +69,6 @@ public class Game extends ApplicationAdapter { } } - for (int i = 0; i < dice.size(); i++) { //lock dice, iterating over for each keycode Die die = dice.get(i); //die iterator is looking at int keyCode = Input.Keys.NUM_1 + i; //keycode for the current die, 1, 2...9, 0 on keyboard @@ -93,6 +96,15 @@ public class Game extends ApplicationAdapter { for (Die die : dice) { die.render(batch); } + + int x = 50; + for (Segment segment : segments) { + String prefix = "[#9E65A8]"; + if (segment.isDestroyed()) prefix = "[#EBE5EC]"; + else if (segment.isDestroyedBy(dice)) prefix = "[#528154]"; + + font.draw(batch, prefix + segment.getName(), x += 75, Gdx.graphics.getHeight() - 100); + } //----- batch.end(); diff --git a/core/src/com/monjaro/gamejam/segment/Segment.java b/core/src/com/monjaro/gamejam/segment/Segment.java index 5086c0c..f9b5749 100644 --- a/core/src/com/monjaro/gamejam/segment/Segment.java +++ b/core/src/com/monjaro/gamejam/segment/Segment.java @@ -18,10 +18,6 @@ public abstract class Segment { public abstract boolean isDestroyedBy(List die); - public String getName() { - return name; - } - protected Map countValues(List dice) { Map counts = new HashMap<>(); @@ -35,4 +31,12 @@ public abstract class Segment { return counts; } + public String getName() { + return name; + } + + public boolean isDestroyed() { + return destroyed; + } + }