SHARE
TWEET

Untitled

a guest Oct 6th, 2015 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Sliderche extends Actor {
  2.         private Slider slider;
  3.         private Table container;
  4.        
  5.         public Sliderche(){
  6.                
  7.                 //Slider
  8.                 Slider.SliderStyle ss = new Slider.SliderStyle();
  9.                 ss.background = new TextureRegionDrawable(new TextureRegion(Assets.manager.get(Assets.slider, Texture.class)));
  10.                 ss.knob = new TextureRegionDrawable(new TextureRegion(Assets.manager.get(Assets.sliderKnob, Texture.class)));
  11.                
  12.                 slider = new Slider(0f, 10, 1f, false, ss);
  13.                 slider.setPosition(0, 0);
  14.                
  15.                 slider.addListener(new InputListener() {
  16.                         @Override
  17.                         public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
  18.                                 System.out.println("slider " + slider.getValue());
  19.                         }
  20.                         @Override
  21.                         public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
  22.                                 System.out.println("touch down");
  23.                                 return true;
  24.                         };
  25.                 });
  26.                
  27.                 container = new Table();
  28.                 container.addActor(slider);
  29.                 container.setFillParent(true);
  30.                
  31.         }
  32.        
  33.     @Override
  34.     public void act(float delta) {
  35.         super.act(delta);
  36.     }
  37.    
  38.          @Override
  39.      public void draw(Batch batch, float parentAlpha) {
  40.         super.draw(batch, parentAlpha);
  41.         container.draw(batch, parentAlpha);
  42.      }
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top