Hot answers tagged

8 votes
Accepted

What is the difference between expand(), grow() and fill() in libGDX?

Expand: expands the cell that the actor is currently placed in to occupy the largest possible area without changing other cells size. For example if the cell is <...
Charanor's user avatar
  • 7,800
7 votes

LibGDX : Textfield input type

I found out a solution to your other problem. To allow the typing of a dot you should create your own implementation of TextFieldFilter like this. ...
Zigur's user avatar
  • 93
6 votes
Accepted

What is the difference between a Listener and a CaptureListener in LibGDX Scene2D

According to the official LibGDX wiki, capture listeners are called before "normal" listeners to give you a chance to intercept the events. (i.e. Active window cancels click on button under ...
Winter's user avatar
  • 341
4 votes

Scene2D set table cell size in percentage of tables ´s size

You can change the Actor that the Value acts on by supplying the actor (in your case your ...
Charanor's user avatar
  • 7,800
4 votes

Independent Column sizes in Scene2D Table in LibGDX

There is an option to do this: First of all you need to find out what your smallest size of a column is, therefore you have to merge all rows into one and pick the smallest width of all columns. the ...
Octopops's user avatar
3 votes
Accepted

Undetected Null Pointer Exception in TextureRegions

You don't initialize your currentframeRight and currentFrameLeft in the constructor. Put this in the constructor of ...
Jacob's user avatar
  • 2,522
3 votes
Accepted

Scene2d scrollbar not showing even though it exists in uiskin.json/atlas

The cause of this problem is actually the way I constructed the ScrollPane object. I called the ScrollPane(widget) constructor ...
MrPlow's user avatar
  • 337
3 votes
Accepted

How to create card layout in a trading card game Libgdx

How does this look? (Green and red lines are only there for debugging) What I did to achieve this was to first separate the card into three columns and five rows; then I had the Cost, Life, Attack, ...
Charanor's user avatar
  • 7,800
3 votes
Accepted

How do I create a ToggleButton via code?

Quoting the javadocs of the Button class: Each time a button is clicked, the checked state is toggled. So the buttons are probably checked, you just can't see ...
Charanor's user avatar
  • 7,800
2 votes

LibGDX: Do I have to dispose a texture if I load it from AssetManager?

You shouldn't call dispose directly on a Texture loaded by an AssetManager, they are ...
bornander's user avatar
  • 4,461
2 votes
Accepted

LibGDX: Problems with Button Listener in a Dialog

The problem is, that I should not add a listener when I'm using the "button()" method, the correct way to use this method is, simply add the button, and as a second argument, you pass an object to ...
Alex Pi's user avatar
  • 93
2 votes

LibGDX: How to handle Touchpad input?

Why not just use it with a Stage and Table as intended? ...
Charanor's user avatar
  • 7,800
2 votes
Accepted

How to smooth scene2d ui default skin?

Open ui_skin.atlas in your GDX project and change the 3rd line to: filter: Linear,Linear It will apply linear min/mag filters to textures and they should look a ...
Jacob's user avatar
  • 2,522
2 votes

Stopping Actor tap/click event from propagating

I had the same problem with a window (scene2d.ui.Window). It would propagate click and other events though it shouldn't. I solved it by doing this: ...
Betalord's user avatar
2 votes
Accepted

LibGDX How to set spacing between list items in a Scene 2D Select Box Widget?

You can do this using: selectBoxStyle.listStyle.selection.setTopHeight(10);
user97574's user avatar
2 votes
Accepted

LibGDX - Wait for action to complete

You can create an Action that is shared across Actors and that counts down a value to zero, then use this state in conjuction ...
bornander's user avatar
  • 4,461
2 votes
Accepted

LibGDX play sound when hovering button

I'm assuming you want to play the sound only once during the whole time of the hover. Since SoundManager does not track sounds it plays, you want to set a flag preventing from playing the sound twice....
Sebastien Servouze's user avatar
2 votes
Accepted

Libgdx pre-rendering Bitmap font to pixmap texture causes slow in-game rendering

The cause of this slowness was my misunderstanding about Libgdx culling. Scene2d does not automatically cull objects outside of the view frustum. Therefore my hundreds of shapes and labels were having ...
The Shoe Shiner's user avatar
1 vote
Accepted

Libgdx scene2d not erasing old texture

Try changing your render methods to this; For StartScreen: ...
bornander's user avatar
  • 4,461
1 vote
Accepted

LibGDX - question about game UI

Create two separate listeners and plug them when you switch your stage/gamemode. Like this: ...
Jacob's user avatar
  • 2,522
1 vote

LibGDX - question about game UI

If you don't have too many buttons/tables and the project is relatively small then using different "if"s is perfectly fine. If you have several of them then it would be better to have a function that ...
Vacster's user avatar
  • 31
1 vote

libGDX - Scene2d Actions or Frame Animation, which is better for performance?

I write in LibGDX for a while and in my opinion it's better to write players movement/rotation/jumping in the code directly and leave Actions for the UI. It depends ...
Jacob's user avatar
  • 2,522
1 vote
Accepted

GUI scaling: Viewport-based scaling or individual logic

The Android-style would be to create custom layouts for each viewport size. This limits you, of course, to only handling a fixed set of viewport sizes but there are only a limited number of monitor ...
Patrick Hughes's user avatar
1 vote

GUI scaling: Viewport-based scaling or individual logic

libgdx provide a utility class called viewport to deal with different screen resolutions problem , each time the screen resolution changes you have to update the viewport: ...
Dr.MSM's user avatar
  • 143
1 vote
Accepted

Scene Transition in libgdx

There are a lot of different kinds of transition. To concretely answer this question clarify which kind of transition you are looking for. If you want to do a blended transition, you'll need to ...
Will Iverson's user avatar
1 vote

Table background not showing up

I've had this exact problem before, so I'll try to remember how I solved it. I recommend turning on the stage.debugAll() while you develop: It is a god send at ...
Jonathan Camarena's user avatar
1 vote

LibGDX, vertical group not displaying

It seems that if the VerticalGroup is added to another layout, then it works. Looking at the code, this is due to VerticalGroup ...
Townsfolk's user avatar
  • 173
1 vote

Hand cards auto arrangement

I would comment on Daedrics answer but I don't have enough rep. His detailed explanation is great and is pretty much already handled by LibGdx's HorizontalGroup() ...
user2209486's user avatar
1 vote

Creating actor comprising multiple other actors - controlling where pieces are drawn

From the comments: the solution seems to be to make MyActor extend Group, then add the constituent actors to that group. ...
bornander's user avatar
  • 4,461

Only top scored, non community-wiki answers of a minimum length are eligible