Questions tagged [libgdx]

'libGDX' is an open-source cross-platform Java game development framework based on OpenGL (ES) that works on Windows, Linux, Mac OS X, Android, iOS and WebGL enabled browsers.

libgdx
Filter by
Sorted by
Tagged with
117 votes
9 answers
54k views

"File not found" when running new LibGDX project

I trying to learn LibGDX, I install all the software listed here with a new Eclipse 4.3 on a fresh formatted mac OS X Maverick. Everything goes smooth, after a reboot, I download, and execute the gdx-...
lebill's user avatar
  • 1,293
24 votes
2 answers
29k views

How to render Android's YUV-NV21 camera image on the background in libgdx with OpenGLES 2.0 in real-time?

Unlike Android, I'm relatively new to GL/libgdx. The task I need to solve, namely rendering the Android camera's YUV-NV21 preview image to the screen background inside libgdx in real time is multi-...
Ayberk Özgür's user avatar
59 votes
6 answers
41k views

Changing the Coordinate System in LibGDX (Java)

LibGDX has a coordinate system where (0,0) is at the bottom-left. (like this image: https://i.stack.imgur.com/jVrJ0.png) This has me beating my head against a wall, mainly because I'm porting a game ...
Sosavpm's user avatar
  • 693
37 votes
2 answers
29k views

libgdx SpriteBatch render to texture

Is it possible to render to texture using SpriteBatch in libGdx (Java engine for Android/Desktop)? If so, how do it? Basically I want to render everything to 320 x 240 region of 512 x 256 texture and ...
PiotrK's user avatar
  • 4,272
81 votes
7 answers
62k views

How to deal with different aspect ratios in libGDX?

I have implemented some screens using libGDX that would obviously use the Screen class provided by the libGDX framework. However, the implementation for these screens works only with pre-defined ...
Rafay's user avatar
  • 6,158
0 votes
1 answer
4k views

Adding Admob to libgdx

RelativeLayout layout = new RelativeLayout(this); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); View gameView = initializeForView(new MainGame(), config); ...
user7585238's user avatar
48 votes
2 answers
48k views

Default Skin LibGDX?

I've been following this: https://code.google.com/p/table-layout/#Quickstart to get a little introduction to tables in LibGDX. I already experimented around a little with buttons. Now I have this ...
AreusAstarte's user avatar
  • 1,988
34 votes
10 answers
36k views

How to draw smooth text in libgdx?

I try to draw simple text in my android game on libgdx, but it's look sharp. How to make text look smooth in different resolutions? My Code: private BitmapFont font; font = new BitmapFont(); font....
JustOneMan's user avatar
28 votes
3 answers
21k views

How get a string width in Libgdx?

I wonder know how to get the width of my string in pixels
LeSam's user avatar
  • 1,245
10 votes
1 answer
8k views

LibGDX: How to make tiled map tiles clickable?

How can I add click listeners for the tiles from tiled map so that when you select a tile with the mouse it becomes highlighted?
Andrew's user avatar
  • 1,109
85 votes
14 answers
187k views

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

I'm trying to add google play services to my libGDX project in IntelliJ Idea. I've followed the setup guide here: https://developers.google.com/android/guides/setup which looks pretty straightforward. ...
Fran Marzoa's user avatar
  • 4,397
11 votes
3 answers
22k views

"Tainted canvases may not be loaded" Cross domain issue with WebGL textures

I've learnt a lot in the last 48 hours about cross domain policies, but apparently not enough. Following on from this question. My HTML5 game supports Facebook login. I'm trying to download profile ...
Will Calderwood's user avatar
8 votes
2 answers
9k views

Using scene2d.ui with libgdx: where does the skin come from?

I've read about libgdx's scene2d features, including the UI elements, but I can't get them to work. They all seem to use a skin object, how do I create one? I've gone through the nice tutorial that ...
Don Kirkby's user avatar
  • 55.3k
8 votes
2 answers
6k views

Libgdx gl10.glLineWidth()

I have this line: Gdx.gl10.glLineWidth(width); Now, I do intend to draw a pretty thick line, and, unfortunately when I type in small values like 1 or 5 the line is obviously small. But once I surpass ...
csga5000's user avatar
  • 4,112
5 votes
4 answers
6k views

Converting Android Bitmap to LibGdx's Texture

i am trying to convert bitmap into a libGDX Texture by converting: Android Bitmap to byte[] byte[] to libGDX Pixmap libGDX Pixmap to libGDX Texture The problem I am facing is that the bitmap which ...
Kumar Saurabh's user avatar
34 votes
3 answers
71k views

How to create a button in Libgdx?

I want to create a button that changes when the user hovers it, or clicking it. I created the following variable Button buttonPlay = new Button(); I don't know what to do now, how to load the ...
julian's user avatar
  • 4,654
30 votes
3 answers
71k views

Could not find class XXX referenced from method XXX.<YYY>

I'm working on a libGDX project and I have a class called CheerVArachnids that has another inline class which is an event listener. When I run this project on the desktop it works fine. BUT when I run ...
b-ryce's user avatar
  • 5,798
18 votes
3 answers
15k views

Error at building model of new Gradle project for libgdx

I installed Gradle in eclipse and want to import a libgdx Gradle project. But when i click on "Build Model" button, i have an error at about 50% of the loading bar. Here is the problem : > Plug-in:...
Mieus's user avatar
  • 306
16 votes
4 answers
13k views

Using unProject correctly in Java Libgdx

I want to make a button clickable, but it isn't working - it seems like I need to use unproject() but I can't figure out how. The code in question is: Texture playButtonImage; SpriteBatch batch; ...
Chimpanse's user avatar
  • 260
11 votes
2 answers
8k views

How to put properly a libgdx application inside swing application?

I'm creating a level editor for my game, and I ave a problem using LwjglCanvas with a JFrame. I use a JFrame (not a LwjglFrame) to keep engine and level editor as independent as possible. I have two ...
dooxe's user avatar
  • 1,481
10 votes
6 answers
17k views

Managing assets between desktop and device version in libgdx

I'm building a little Android game using libgdx. For now I have a copy of the game's assets in the desktop project folder and the Android project folder. For some strange reason I have to access those ...
Boris's user avatar
  • 8,773
10 votes
3 answers
5k views

Circle and Polygon Collision with Libgdx

Is there a way in Libgdx to verify a collision between a Polygon and a Circle? I saw the Intersector class but only found collision test for Circle and Rectangle. What about any other Polygon? If I ...
Cristiano Santos's user avatar
7 votes
7 answers
19k views

How do I detect if a sprite was touched in Java libGDX?

In the past few days I've been porting my game (Apopalypse) to the Android Mobile platform. I've did a quick search on Google of sprite touch detection but didn't find anything helpful. Each balloon ...
miguel.renaud's user avatar
4 votes
1 answer
8k views

Libgdx Box2D pixel to meter conversion?

When trying to program a game using Box2D, I ran into a problem with Box2D. I filled in pixel numbers for the lengths of the the textures and sprites to create a box around it. Everything was at the ...
dragonfly's user avatar
  • 143
48 votes
4 answers
33k views

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

For my game, I'd like the Android back button to take you to the pause menu, instead of minimizing the game. From what I've googled, I know I need to call Gdx.input.setCatchBackKey(true); But how do ...
Dmiters's user avatar
  • 2,021
38 votes
3 answers
35k views

How do I troubleshoot "Inconsistency detected: dl-lookup.c: 111" (Java Result 127) error?

I'm currently trying to build a Java project using Maven for a libGDX game I'm working on. I think I'm using Java 8 OpenJDK (1.8.0_211) on a Ubuntu 18.04 LTS distribution. The related question ...
user avatar
25 votes
1 answer
16k views

When to use actors in libgdx? What are cons and pros?

I'm writing simple solar system simulator. This is my first libgdx project. I'm using a Stage and Actors for the main menu and is pretty handy especially touch events handling. But ... looking at the ...
Lord_JABA's user avatar
  • 2,595
13 votes
2 answers
8k views

libgdx TextureRegion to Pixmap

How do I create Pixmap from TextureRegion or from Sprite? I need this in order to change color of some pixels and then create new Texture from Pixmap (during loading screen).
Mickey Tin's user avatar
  • 3,458
10 votes
3 answers
5k views

How do libgdx detect keyboard presence

When writing in the Textfield, I need my textfield to move upwards in order to let the textfield be visible when the keyboard pops up. Does libgdx have some kind of method which returns true if the ...
Patrick Romstad's user avatar
8 votes
1 answer
6k views

How Camera works in Libgdx and together with Viewport

If you work with LibGdx it goes not long until you come to Camera and viewport. If you work the first time with camera and Viewport you get some questions about how it works and how to use it. So: ...
Morchul's user avatar
  • 2,037
8 votes
2 answers
7k views

LibGDX HelloWorld project crashes when run on Android emulator

I've been trying to get the Hello-World project to run as part of learning LibGDX. Using the Nightly Build (libgdx-nightly-20140322). However, I have become quite frustrated because the hello-world-...
Jamie Le Rossignol's user avatar
7 votes
2 answers
13k views

Libgdx light without box2d

I just started creating a game using libgdx. It is a top down 2d shooter using scene2d ui. Now i thought, that i could add darkness and light to some levels, but i don't want to rewrite everything ...
Robert P's user avatar
  • 9,581
6 votes
8 answers
27k views

Rotate Image Clockwise using LibGDX

How can we rotate a Image Clockwise using LibGDX? what i am looking is when a image is loaded,suppose a star, i need to rotate it from beginning of screen to end of the screen horizontally, with star ...
Alex Mathew's user avatar
  • 1,544
5 votes
2 answers
2k views

Add Actions.scaleTo() to a Label in LibGDX

In LibGDX, I want to make a text animation for my game. Therefore, I want that my labels gets larger with time. But if I use the scaleTo() method, nothing happens whereas other Actions like moveTo() ...
erik4thewinners's user avatar
4 votes
8 answers
13k views

why game is running slow in libgdx?

I am making racing game in Libgdx.My game apk size is 9.92 mb and I am using four texture packer of total size is 9.92 Mb. My game is running on desktop but its run on android device very slow. What ...
Vishal Singh's user avatar
3 votes
2 answers
3k views

Libgdx's World Units

I've been trying to learn libgdx a little but now i'm kinda confused about world units there that i don't even know what exact question i should be asking. Anyway, i've been reading this example game ...
Wiktor's user avatar
  • 915
3 votes
2 answers
2k views

Boolean not changing in thread

I have a class MPClient and MultiplayerMatch. MultiplayerMatch, in his constructor, creates a MPClient runnable thread. To avoid data overflow, I have a boolean named "moved" in MultiplayerMatch that ...
Evenilink's user avatar
3 votes
1 answer
1k views

libgdx ScissorStack not working as expected

I'm trying to create a "progress bar" of sorts but the clipping doesn't seem to work the way I expect it to. Is this something I am doing wrong or something I've misinterpreted? The draw() routine ...
twig's user avatar
  • 4,084
2 votes
2 answers
3k views

Using LibGDX, how do you have an animation using seperate images ?

I'm learning how to make games using LibGDX and I'm trying to make a small platform game (using Eclipse). I made 4 images on the main character running to make an animation when he moves. However, I ...
LeoQLF's user avatar
  • 63
2 votes
1 answer
2k views

LibGdx resolutionFileResolver + Assetmanager, file names?

I want to use the resolution file resolver to select a correct texture atlas for my app, so I createa RFR with a couple of resolutions: Resolution _568x1136 = new Resolution(568, 1136, ".568x1136"); ...
Myth1c's user avatar
  • 639
1 vote
2 answers
3k views

LibGdx-ViewPort width and height does not match for some devices

I am using a Viewport for my libGdx landscape game like this. public static final int WORLD_WIDTH = 1280; public static final int WORLD_HEIGHT = 800; camera = new OrthographicCamera(); float ...
Niranjana's user avatar
  • 526
1 vote
1 answer
1k views

How can I implement AdMob Ads in a LibGDX Android project?

I found this Flappy Bird GIT project: https://github.com/barodapride/flappy-tutorial-barodapride How can I implement the BannerAd in this? There is no layout file. And how can I implement the ...
Fisch Gesicht's user avatar
43 votes
5 answers
42k views

TrueType Fonts in libGDX

Does anyone know how I can use a TTF font in libGDX? I have looked around and have seen things about StbTrueTypeFont but it doesn't seem to be in the latest release. EDIT: I found the StbTrueType ...
Alex_Hyzer_Kenoyer's user avatar
27 votes
3 answers
16k views

Libgdx setup UI gives 2 unexpected errors in new GWT project

I have run the setup ui, however, I get two different errors in the -html project than what is described in the tutorial: libgdx tutorial The tutorial error stated is as follows (which is an error I ...
BigBug's user avatar
  • 6,270
26 votes
4 answers
14k views

How to add libgdx as a sub view in android

I have main.xml as follows: <RelativeLayout> ... <FrameLayout android:id="@+id/panel_sheet" android:layout_width="match_parent" ...
Quicklaunch Technology's user avatar
24 votes
3 answers
37k views

Actions of Actors in libgdx

I have made my Actor, but I am unclear on how to take advantage of the action and act methods. Outside of the basic Javadoc, I have not found a good tutorials on these methods. Can anyone provide an ...
Rudy_TM's user avatar
  • 1,420
22 votes
2 answers
34k views

Button ClickListener is not working in LibGDX game

I am developing an Android game using LibGDX. There are 4 buttons in a menu screen, but the ClickListener of these buttons is not working. // retrieve the custom skin for our 2D widgets Skin skin =...
sandee's user avatar
  • 349
21 votes
2 answers
14k views

How to do blending in LibGDX

I basically want to play around with blending modes in LibGDX but don't know how to do it. I found this image on internet. I want to do the same thing on LibGDX. Can someone teach me how. I've been ...
Ezekiel Baniaga's user avatar
17 votes
2 answers
7k views

Is there an upper limit on velocity when using box2d?

I'm using box2d for physics simulation. I'm moving a circle using arrow keys by applying impulse on the body when ever a key is pressed. Unfortunately, the circle moves excruciatingly slow and doesn't ...
ivymike's user avatar
  • 1,581
16 votes
3 answers
16k views

How to get a Label with wrapped text?

I ave tried the following code: Label label = new Label(reallyLongString, skin); label.setWrap(true); label.setWidth(100); // or even as low as 10 table.add(label); ... and yet all I get is a very ...
talloaktrees's user avatar
  • 3,638

1
2 3 4 5
21