Questions tagged [scene2d]

Scene2d is a 2D scene graph for building applications and UIs using a hierarchy of "actors". Integrated in libGDX.

Scene2d is a 2D scene graph for building applications and UIs using a hierarchy of actors. Integrated in . It provides the following features:

  • Rotation and scale of a group is applied to all child actors. Child actors always work in their own coordinate system, parent transformations are applied transparently.

  • Simplified 2D drawing via SpriteBatch. Each actor draws in its own un-rotated and unscaled coordinate system where 0,0 is the bottom left corner of the actor.

  • Hit detection of rotated and scaled actors. Each actor determines if it is hit using its own un-rotated and unscaled coordinate system.

  • Routing of input and other events to the appropriate actor. The event system is flexible, enabling parent actors to handle events before or after children.

  • Action system for easy manipulation of actors over time. Actions can be chained and combined for complex effects.

519 questions
5
votes
2 answers

LibGDX scene2D - Can swapActor be used to change position in table?

I want to swap the positions of two labels inside a table of libGDX. I thought I may use swapActors to do this, but it doesn't do the trick. private Stage stage; private Table table; public MainScreen() { stage = new Stage(new FitViewport(800,…
angelnoir
  • 51
  • 3
5
votes
1 answer

LibGDX: Skin + Custom Coordinates Draw Incorrectly

I'm using libgdx to make a simple game and I want to use scene2Dui and a stage and skin to simplify a lot of my positioning/sizing code. To further simplify the positioning of everything, I also want to define a custom coordinate system so that…
Ishod
  • 51
  • 3
5
votes
3 answers

Scene2d how to handle touched actor?(LibGDX)

I have a problem with using scene2d in libgdx. I can't find anywhere a method that allows me to check wheter the actor is touched or not. I can only find methods that told me if actor was touched or released. In my game, when actor is pressed and…
Pawel
  • 113
  • 3
  • 8
4
votes
1 answer

libGDX throwing an error for the default vertex shader in a SpriteBatch

I am new to libGDX and am using it to complete a big game for a school project. I have been following an online tutorial for most of the code, but can't seem to run because of a Vertex Shader error. Error: Fragment shader: ERROR: 0:1: '' : …
4
votes
1 answer

libgdx actor won't change position

If an actor is moved by its own actor.act() method, it updates the position flawlessly. But if I move the actor by a group, which contains the actor, with the moveBy() method or a moveBy action, the actor moves, but its getX() and getY() values stay…
Stefan B
  • 541
  • 2
  • 6
  • 13
4
votes
0 answers

Draw formatted text with libgdx

How can I draw formatted text with libgdx's Scene2D? There is what I found: libgdx/Color Markup Language But it's not enough. I want to implement some kind of markdown via MarkdownLabelActor. So, I must create Bitmaps for each type of expected…
Alexandr
  • 3,859
  • 5
  • 32
  • 56
4
votes
1 answer

How to zoom in and out on a stage in libgdx Scene2d?

I am making a 2d game using libgdx and am adding hexagon shaped actors to a group which is then added to a stage. For a normal camera you can use camera.zoom in the render method to zoom in and out along with camera.translate to pan around the…
EssEllDee
  • 169
  • 1
  • 11
4
votes
2 answers

How to detect if the device is a smartphone or tablet in libgdx?

I want a certain ui element in my scene2d ui to scaledown on larger screens(not necessarily higher resolution screens). Its pretty straight forward in Android layout but how to get it working in libgdx. Maybe some API that I am missing ? Can it be…
tej ethical
  • 163
  • 2
  • 10
4
votes
1 answer

Could not set scene2d.ui.Dialog size

I'm trying to display a dialog in the middle of the screen. But I couldn't change the size of the dialog with setWidth() or setHeight(). I have the following code: private void showDialog() { Window.WindowStyle dialogStyle = new…
user3740097
4
votes
1 answer

Make scene2d.ui table with alternate row colours?

I have created a scene2d.ui Table and would like to alternate the background colours of each row. I've had a look through the various table and cell methods but there doesn't seem to be an obvious way of doing it. Is it even possible? And if so,…
eby
  • 191
  • 2
  • 12
4
votes
1 answer

How to get the world coordinates of a point in a child actor?

I have Group objects that consist of other Group objects, that finally consist of Actor objects. Now, when the groups and actors are rotated, offset and scaled, the coordinates in the "world", or in relation to the root node change. How do I get the…
manabreak
  • 5,415
  • 7
  • 39
  • 96
4
votes
2 answers

Libgdx Pixellated GUI Effect

In LibGDX, I am currently trying to achieve the effect of a pixellated GUI, meaning the buttons are pixellated, like an 8-bit theme. When I make my GUI elements, such as a TextButton, I am using images that are small, say 34x16 pixels, but I am…
Matthew Tory
  • 1,306
  • 2
  • 16
  • 30
4
votes
1 answer

LibGDX Scene2D: Actions won't work at all for actors inside groups

I am trying to fade an Actor out using the Action FadeOut. However, I've discovered that the no actions work at all for my objects. The hierarchy of my classes are like this: Actor -> MoveableObject -> Knight Stage -> KnightGroup (Group) ->…
Kenneth Wang
  • 191
  • 10
4
votes
1 answer

libgdx: scene2d + box2d - units

I'm working on my first LibGdx (Scene2d + Box2d) game, it's quite new field for me and still feel a bit confused about couple things, especially about units. Already seen few different approaches how to deal with it, but still not sure for what's…
majuszt
  • 75
  • 5
4
votes
1 answer

libgdx background Image change

I want to change background image of a menu every x-amount of seconds. I'm using libGDX scene2D.ui for making the menu. The TestScreen class extends the AbstractScreen which is a abstract class that implements libGDX's Screen class. Problem: After I…
Artash
  • 569
  • 6
  • 11
1 2
3
34 35