title: LIBGDX - Touchpad
body: <p>I can't figure out why I'm not able to see my thouchpad that I've created, but it works. Here is the code</p>
  
  <pre><code>package com.mygdx.game;
  
  import com.badlogic.gdx.graphics.Texture;
  import com.badlogic.gdx.scenes.scene2d.ui.Skin;
  import com.badlogic.gdx.scenes.scene2d.ui.Touchpad;
  import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
  
  
  public class AnalogStick extends Touchpad {
  
      private static Touchpad.TouchpadStyle touchpadStyle;
      private static Skin touchpadSkin;
      private static Drawable touchBackground;
      private static Drawable touchKnob;
  
      public AnalogStick(float x, float y) {
  
          super(10, getTouchpadStyle());
          setBounds(15, 15, 200, 200);
          setPosition(x,y);
  
      }
  
      private static Touchpad.TouchpadStyle getTouchpadStyle() {
  
          touchpadSkin = new Skin();
          touchpadSkin.add("touchBackground", new Texture("touchBackground.png"));
  
          touchpadSkin.add("touchKnob", new Texture("touchKnob.png"));
  
          touchpadStyle = new Touchpad.TouchpadStyle();
  
          touchBackground = touchpadSkin.getDrawable("touchBackground");
          touchKnob = touchpadSkin.getDrawable("touchKnob");
  
          touchpadStyle.background = touchBackground;
          touchpadStyle.knob = touchKnob;
  
          return new TouchpadStyle();
      }
  }
  </code></pre>
  
  <p>And in my Create class I use this code for adding it into the stage</p>
  
  <pre><code>        asMove = new AnalogStick(15,15);
  
          Gdx.input.setInputProcessor(stage);
  
          playerTexture = new Texture(Gdx.files.internal("player.png"));
          playerSprite = new Sprite(playerTexture);
  
          stage = new Stage(new ScreenViewport(), batch);
          stage.addActor(asMove);
          Gdx.input.setInputProcessor(stage);
  </code></pre>
  
  <p>And in the render method this code</p>
  
  <pre><code>        stage.act(Gdx.graphics.getDeltaTime());
          stage.draw();
  </code></pre>