add numbers for test display

This commit is contained in:
James 2024-04-20 15:45:42 +01:00
parent 6abb79e3a9
commit cfbe8ad8b4
2 changed files with 26 additions and 1 deletions

View file

@ -60,4 +60,12 @@ public class Die extends Actor {
}
}
public Face getFace() {
return faces[faceIndex];
}
public int getFaceValue() {
return getFace().getValue();
}
}

View file

@ -2,10 +2,11 @@ package com.monjaro.gamejam;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
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 jdk.vm.ci.hotspot.JFR;
import java.util.ArrayList;
import java.util.HashSet;
@ -16,7 +17,10 @@ public class Game extends ApplicationAdapter {
private final Set<Actor> actors = new HashSet<>();
private final List<Die> dice = new ArrayList<>();
private SpriteBatch batch;
private BitmapFont font;
private Texture img;
private final static int TICKS_PER_SECOND = 60;
@ -25,7 +29,12 @@ public class Game extends ApplicationAdapter {
@Override
public void create() {
batch = new SpriteBatch();
font = new BitmapFont();
img = new Texture("badlogic.jpg");
for (int i = 0; i < 5; i++) {
dice.add(new Die());
}
}
public void tick() {
@ -45,6 +54,14 @@ public class Game extends ApplicationAdapter {
actors.forEach(a -> a.render(batch));
//TODO debug
int x = 100;
for (Die die : dice) {
batch.setColor(Color.WHITE);
font.draw(batch, String.valueOf(die.getFaceValue()), x += 50, 100);
}
//-----
batch.end();
}