adds font
This commit is contained in:
parent
97639fca47
commit
605d81d35e
3 changed files with 13 additions and 4 deletions
BIN
assets/fonts/single_day_regular.ttf
Normal file
BIN
assets/fonts/single_day_regular.ttf
Normal file
Binary file not shown.
|
@ -47,6 +47,7 @@ project(":desktop") {
|
||||||
implementation project(":core")
|
implementation project(":core")
|
||||||
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
|
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
|
||||||
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
|
api "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,6 +58,7 @@ project(":core") {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||||
|
api "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.badlogic.gdx.Input;
|
||||||
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.BitmapFont;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||||
import com.badlogic.gdx.math.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
import com.badlogic.gdx.utils.ScreenUtils;
|
import com.badlogic.gdx.utils.ScreenUtils;
|
||||||
import com.monjaro.gamejam.SegmentUI;
|
import com.monjaro.gamejam.SegmentUI;
|
||||||
|
@ -35,8 +36,6 @@ public class Game extends ApplicationAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
batch = new SpriteBatch();
|
batch = new SpriteBatch();
|
||||||
font = new BitmapFont();
|
|
||||||
font.getData().markupEnabled = true;
|
|
||||||
img = new Texture("badlogic.jpg");
|
img = new Texture("badlogic.jpg");
|
||||||
|
|
||||||
segUi = new SegmentUI(new Rectangle(0, (Gdx.graphics.getHeight()/3)*2, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/3));
|
segUi = new SegmentUI(new Rectangle(0, (Gdx.graphics.getHeight()/3)*2, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/3));
|
||||||
|
@ -52,6 +51,14 @@ public class Game extends ApplicationAdapter {
|
||||||
SegmentUI.setCriteriaSheet(new Texture("criteria.png"));
|
SegmentUI.setCriteriaSheet(new Texture("criteria.png"));
|
||||||
// SegmentUI.setCriteriaSheet(""); not made yet
|
// SegmentUI.setCriteriaSheet(""); not made yet
|
||||||
|
|
||||||
|
// setting up font
|
||||||
|
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/single_day_regular.ttf"));
|
||||||
|
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
|
||||||
|
parameter.size = 12;
|
||||||
|
font = generator.generateFont(parameter); // font size 12 pixels
|
||||||
|
generator.dispose(); // don't forget to dispose to avoid memory leaks!
|
||||||
|
font.getData().markupEnabled = true;
|
||||||
|
|
||||||
float divide = Gdx.graphics.getWidth() / 6f;
|
float divide = Gdx.graphics.getWidth() / 6f;
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
dice.add(new Die(divide * (i + 1), 350, 64, 64));
|
dice.add(new Die(divide * (i + 1), 350, 64, 64));
|
||||||
|
|
Loading…
Add table
Reference in a new issue