TrueType Fonts in libGDX

Yes you will definitely need to add the gdx-stb-truetype jars to your project as you stated in your edit. Here is how you will use it, pretty straighforward… First you need to declare your BitmapFont and the characters you will use… BitmapFont font; public static final String FONT_CHARACTERS = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][_!$%#@|\\/?-+=()*&.;,{}\”´`'<>”; Then you need to create … Read more

Drawing transparent ShapeRenderer in libgdx

The following code is working for me in this case, maybe it will help someone else: Gdx.gl.glEnable(GL10.GL_BLEND); Gdx.gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); shapeRenderer.setProjectionMatrix(camera.combined); shapeRenderer.begin(ShapeType.FilledCircle); shapeRenderer.setColor(new Color(0, 1, 0, 0.5f)); shapeRenderer.filledCircle(470, 45, 10); shapeRenderer.end(); Gdx.gl.glDisable(GL10.GL_BLEND);

Default Skin LibGDX?

When it comes to UI in libGDX, you will find its very different than what you would have used before (yaml, json, xml, UI Builders, etc). Table Layout – This is how Scene2d UI is structured and formatted. The link you have provided is a great tutorial, but as you have come to realize, you … Read more

In libgdx, how do I get input from the back button?

I solved the problem like this: public class MyApplication implements ApplicationListener, InputProcessor { // !! Remember to override all other required methods !! … @Override public void create() { Gdx.input.setInputProcessor(this); Gdx.input.setCatchBackKey(true); // rest of your stuff… } … @Override public boolean keyDown(int keycode) { if(keycode == Keys.BACK){ // Do your optional back button handling (show … Read more

Changing the Coordinate System in LibGDX (Java)

If you use a Camera (which you should) changing the coordinate system is pretty simple: camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); If you use TextureRegions and/or a TextureAtlas, all you need to do in addition to that is call region.flip(false, true). The reasons we use y-up by default (which you can easily change as … Read more

Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle

I had the issue when I put jcenter() before google() in project level build.gradle. When I changed the order and put google() before jcenter() in build.gradle the problem disappeared Here is my final build.gradle // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } … Read more

“File not found” when running new LibGDX project

From libgdx wiki When you run Desktop Project The application will fail the first time. Open the Run Configuration you just created and set the working directory to the android/assets/ directory! link your desktop project to android assets folder? Go to Run => Run Configurations.. => choose DesktopLauncher, Arguments Tab => Working Directory => Others … Read more

tech