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 <...
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 ...
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 ...
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 ...
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 ...
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, ...
3
votes
LibGDX: How to handle Touchpad input?
Why not just use it with a Stage and Table as intended?
...
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 ...
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 ...
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:
...
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 ...
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 ...
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);
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 ...
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....
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 ...
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:
...
1
vote
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 ...
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.
...
1
vote
Accepted
Libgdx scene2d not erasing old texture
Try changing your render methods to this;
For StartScreen:
...
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 ...
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 ...
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:
...
1
vote
Image Does Not Animate and is Stuck in one Frame
In LevelOneScreen, make your update method call update on ...
1
vote
Accepted
LibGDX - question about game UI
Create two separate listeners and plug them when you switch your stage/gamemode. Like this:
...
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 ...
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 ...
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 ...
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:
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scene2d × 89libgdx × 82
java × 29
android × 12
animation × 5
gui × 5
unity × 4
c# × 3
fonts × 3
android-studio × 3
inventory × 3
textures × 2
box2d × 2
performance × 2
scale × 2
card-game × 2
2d × 1
rendering × 1
sprites × 1
software-engineering × 1
input × 1
transformation × 1
game-loop × 1
entity-system × 1
coordinates × 1