add numbers for test display
This commit is contained in:
parent
6abb79e3a9
commit
cfbe8ad8b4
2 changed files with 26 additions and 1 deletions
|
@ -60,4 +60,12 @@ public class Die extends Actor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Face getFace() {
|
||||||
|
return faces[faceIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFaceValue() {
|
||||||
|
return getFace().getValue();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,11 @@ package com.monjaro.gamejam;
|
||||||
|
|
||||||
import com.badlogic.gdx.ApplicationAdapter;
|
import com.badlogic.gdx.ApplicationAdapter;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
import com.badlogic.gdx.utils.ScreenUtils;
|
import com.badlogic.gdx.utils.ScreenUtils;
|
||||||
import jdk.vm.ci.hotspot.JFR;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -16,7 +17,10 @@ public class Game extends ApplicationAdapter {
|
||||||
|
|
||||||
private final Set<Actor> actors = new HashSet<>();
|
private final Set<Actor> actors = new HashSet<>();
|
||||||
|
|
||||||
|
private final List<Die> dice = new ArrayList<>();
|
||||||
|
|
||||||
private SpriteBatch batch;
|
private SpriteBatch batch;
|
||||||
|
private BitmapFont font;
|
||||||
private Texture img;
|
private Texture img;
|
||||||
|
|
||||||
private final static int TICKS_PER_SECOND = 60;
|
private final static int TICKS_PER_SECOND = 60;
|
||||||
|
@ -25,7 +29,12 @@ public class Game extends ApplicationAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
|
font = new BitmapFont();
|
||||||
img = new Texture("badlogic.jpg");
|
img = new Texture("badlogic.jpg");
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
dice.add(new Die());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
|
@ -45,6 +54,14 @@ public class Game extends ApplicationAdapter {
|
||||||
|
|
||||||
actors.forEach(a -> a.render(batch));
|
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();
|
batch.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue