Skip to main content
9 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,870
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,870
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,552
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,870
3 votes

LibGDX: How to handle Touchpad input?

Why not just use it with a Stage and Table as intended? ...
Charanor's user avatar
  • 7,870
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 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,870
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: 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
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,552
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,516
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

LibGDX search for file types in local file system

You could use Files.walk() along with filter(). Thus if you wanted to get all PNG images, then you could do: ...
vallentin's user avatar
  • 380
1 vote

LibGdx table with label children at fixed positions

Have you tried using a table? ...
dfour's user avatar
  • 768
1 vote
Accepted

How to make members of an Array into an actor and add them to stage?

You load a new Texture in each EnemyAnimation which loads alot of memory. For example if it's a 500x500 image, it has 250,000 ...
Jacob's user avatar
  • 2,552
1 vote

How to make members of an Array into an actor and add them to stage?

An EnemyAnimation is an actor in itself, you do not need to create an actor from the list of EnemyAnimation as the title of your post suggests. ...
realUser404's user avatar
  • 1,057
1 vote
Accepted

Libgdx scene2d not erasing old texture

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

Actor in Stage Does Not Update the MoveTo XY Location

I have found the answer to my own question, I have separated both class to a different stage and this solution works. I know that there is a better way of doing this and I am open for any edits or ...
JAlmazan's user avatar
1 vote

Actor in Stage Does Not Update the MoveTo XY Location

I think the problem is because you are calling this.act(delta) in your ArrowClass' draw method. When you call ...
John's user avatar
  • 658
1 vote
Accepted

Image Does Not Animate and is Stuck in one Frame

I wrote a Ninja class for you. You can test it cause I don't have GDX on this PC here: ...
Jacob's user avatar
  • 2,552
1 vote

Image Does Not Animate and is Stuck in one Frame

In LevelOneScreen, make your update method call update on ...
bornander's user avatar
  • 4,516
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,552
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,552
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

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