Additions to Stage/scene2d

I just commited new additions to the scene2d package. Here’s what has changed.

  • Actor and Stage now implement touchMoved(), scrolled(), keyUp(), keyDown() and keyTyped(), just like any good InputProcessor would.
  • The methods have a default implementation, so you don’t have to a) implement them b) change any of your code
  • To pipe move, key and scroll events to the stage just use the appropriate methods as listed above, e.g. Stage.touchMove(x,y).
  • Move and scroll events only make sense on the Desktop.
  • Besides the touch focus which was implemented in Stage before, there’s also a keyboard and a scroll focus now. Use Group.keyboardFocus(Actor actor) and Group.scrollFocus(Actor actor) to set that focus. All keyboard and scroll events will then be piped to that actor. If you pass null the focus will be removed.
  • Keyboard events and scroll events will only be piped through if your Actor implementation atually call the focus methods of its parent Group!

TL;DR: i added piping all input events to Stage. No need to change anything on your end if you don’t need the new stuff.

2 thoughts on “Additions to Stage/scene2d

  1. Hey Mario,

    Can you make a Mercurial repository in google code page, cuz I would like to keep a LibGDX clone just of 2D stuff, I really don’t need or want the 3D stuff.

Leave a Reply

Your email address will not be published.