3

I made my own simple framework to use with LibGDX but I can't figure out how to make a TouchPad appear on the screen. I need two separate joysticks (LibGDX TouchPads) to be on the screen at once and both handle touch events.

How do I do this? I am able to declare the Touchpads and set their skin but I can't figure out how to display them and how to implement multi-touch.

Vincent Williams
  • 2,836
  • 3
  • 17
  • 22
  • You will need to be a lot more precise about what your problem is. StackOverflow is for fairly precise programming problems. Can you get one touchpad to work correctly? If you're looking for more broad help, you might try the libgdx forums. – P.T. Feb 24 '15 at 04:48
  • I just want to know how to get 2 of the libgdx Touchpads working and on the screen at the same time. And yes i can get one working, but I dont know how to implement it in my code. – Vincent Williams Feb 24 '15 at 18:09
  • I don't understand what you mean by "yes i can get one working, but I dont know how to implement it in my code". You either have 1 working touchpad in your code or you do not. Which is it? Assuming you have actually implemented 1, what specifically is not working when you try to implement the second one? Be specific about the errors you are seeing. What have you tried? See http://stackoverflow.com/help/how-to-ask for more details on asking good questions. – P.T. Feb 24 '15 at 18:44
  • I dont have errors I just have no idea where to start. I meant I had got one working before in a separate app but I cant get any working in this app. Can you take a look at the source code? You mainly only need to look at the MenuState class – Vincent Williams Feb 24 '15 at 19:25

1 Answers1

4

I figured it out. All you have to do is add them to a Stage like so: stage.addActor(touchpad);, then in your render() method you say: stage.act(); stage.draw();. Unlike android, LibGDX handles multi-touch automatically.

Vincent Williams
  • 2,836
  • 3
  • 17
  • 22