Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.Slider#setValue()
The following examples show how to use
com.badlogic.gdx.scenes.scene2d.ui.Slider#setValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NoiseModuleWrapper.java From talos with Apache License 2.0 | 6 votes |
@Override protected void configureSlots() { addInputSlot("X: (0 to 1)", NoiseModule.X); addInputSlot("Y: (0 to 1)", NoiseModule.Y); addOutputSlot("output", NoiseModule.OUTPUT); slider = new Slider(0.5f, 20f, 0.1f, false, getSkin()); leftWrapper.add(slider).growX().padRight(2f).padBottom(5f).row(); slider.setValue(0.5f); noiseImage = new NoiseImage(getSkin()); leftWrapper.add(noiseImage).expandX().fillX().growX().height(100).padRight(3).padBottom(3); slider.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { float frequency = 20f - slider.getValue() + 0.5f; noiseImage.setFrequency(frequency); module.setFrequency(frequency); } }); rightWrapper.add().expandY(); }
Example 2
Source File: Vector4UI.java From gdx-gltf with Apache License 2.0 | 6 votes |
public Vector4UI(Skin skin, final Color value) { super(skin); this.value = value; for(int i=0 ; i<4 ; i++){ final Slider slider = new Slider(0, 1, .01f, false, skin); add(name(i)); add(slider).row(); slider.setValue(get(i)); final int index = i; slider.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { set(index, slider.getValue()); } }); sliders.add(slider); } }
Example 3
Source File: FloatAttributeUI.java From gdx-gltf with Apache License 2.0 | 6 votes |
public FloatAttributeUI(Skin skin, final FloatAttribute attribute) { super(skin); this.attribute = attribute; slider = new Slider(0, 1, .01f, false, skin); if(attribute != null){ add(FloatAttribute.getAttributeAlias(attribute.type)); add(slider).row(); slider.setValue(attribute.value); slider.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { attribute.value = slider.getValue(); } }); } }
Example 4
Source File: Vector3UI.java From gdx-gltf with Apache License 2.0 | 6 votes |
public Vector3UI(Skin skin, final Vector3 value) { super(skin); this.value = value; for(int i=0 ; i<3 ; i++){ final Slider slider = new Slider(-1, 1, .01f, false, skin); add(name(i)); add(slider).row(); slider.setValue(get(i)); final int index = i; slider.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { set(index, slider.getValue()); } }); sliders.add(slider); } }
Example 5
Source File: Vector2UI.java From gdx-gltf with Apache License 2.0 | 6 votes |
public Vector2UI(Skin skin, final Vector2 value) { super(skin); this.value = value; for(int i=0 ; i<2 ; i++){ final Slider slider = new Slider(0, 1, .01f, false, skin); add(name(i)); add(slider).row(); slider.setValue(get(i)); final int index = i; slider.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { set(index, slider.getValue()); } }); } }
Example 6
Source File: ColorAttributeUI.java From gdx-gltf with Apache License 2.0 | 6 votes |
public ColorAttributeUI(Skin skin, final ColorAttribute attribute) { super(skin); if(attribute == null) return; this.attribute = attribute; add(ColorAttribute.getAttributeAlias(attribute.type)); for(int i=0 ; i<4 ; i++){ if(i != 0) add(); final Slider slider = new Slider(0, 1, .01f, false, skin); add(slider).row(); slider.setValue(get(i)); final int index = i; slider.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { set(index, slider.getValue()); } }); sliders.add(slider); } }
Example 7
Source File: WeightsUI.java From gdx-gltf with Apache License 2.0 | 6 votes |
public WeightsUI(Skin skin, final WeightVector value, final Array<String> names) { super(skin); this.value = value; for(int i=0 ; i<value.count ; i++){ final Slider slider = new Slider(0, 1, .01f, false, skin); final int index = i; slider.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { set(index, slider.getValue()); } }); String name = names != null && i < names.size ? names.get(i) : "#" + (i+1); add(name); add(slider).row(); slider.setValue(get(i)); sliders.add(slider); } }
Example 8
Source File: GameStage.java From GdxDemo3D with Apache License 2.0 | 6 votes |
public LayerController(TextureAtlas buttonAtlas) { Slider.SliderStyle sliderStyle = new Slider.SliderStyle(); sliderStyle.knob = new TextureRegionDrawable(buttonAtlas.findRegion("slider-knob-up")); sliderStyle.knobDown = new TextureRegionDrawable(buttonAtlas.findRegion("slider-knob-down")); sliderStyle.knobOver = new TextureRegionDrawable(buttonAtlas.findRegion("slider-knob-down")); sliderStyle.background = new TextureRegionDrawable(buttonAtlas.findRegion("slider-background")); slider = new Slider(minLayer, maxLayer, 1, true, sliderStyle); slider.setValue(maxLayer); slider.setAnimateDuration(0.1f); slider.addCaptureListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { setLayer((int) slider.getValue()); } }); add(slider).height(300); }
Example 9
Source File: TestVertical.java From vis-ui with Apache License 2.0 | 6 votes |
private void addNormalWidgets () { ProgressBar progressbar = new ProgressBar(0, 100, 1, true, VisUI.getSkin()); Slider slider = new Slider(0, 100, 1, true, VisUI.getSkin()); Slider sliderDisabled = new Slider(0, 100, 1, true, VisUI.getSkin()); progressbar.setValue(50); slider.setValue(50); sliderDisabled.setValue(50); sliderDisabled.setDisabled(true); VisTable progressbarTable = new VisTable(true); progressbarTable.add(progressbar); progressbarTable.add(slider); progressbarTable.add(sliderDisabled); add(progressbarTable); }
Example 10
Source File: SteeringTestBase.java From gdx-ai with Apache License 2.0 | 6 votes |
protected void addMaxLinearAccelerationController (Table table, final Limiter limiter, float minValue, float maxValue, float step) { final Label labelMaxLinAcc = new Label("Max.Linear Acc.[" + limiter.getMaxLinearAcceleration() + "]", container.skin); table.add(labelMaxLinAcc); table.row(); Slider maxLinAcc = new Slider(minValue, maxValue, step, false, container.skin); maxLinAcc.setValue(limiter.getMaxLinearAcceleration()); maxLinAcc.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { Slider slider = (Slider)actor; limiter.setMaxLinearAcceleration(slider.getValue()); labelMaxLinAcc.setText("Max.Linear Acc.[" + limiter.getMaxLinearAcceleration() + "]"); } }); table.add(maxLinAcc); }
Example 11
Source File: SteeringTestBase.java From gdx-ai with Apache License 2.0 | 6 votes |
protected void addMaxLinearSpeedController (Table table, final Limiter limiter, float minValue, float maxValue, float step) { final Label labelMaxSpeed = new Label("Max.Lin.Speed [" + limiter.getMaxLinearSpeed() + "]", container.skin); table.add(labelMaxSpeed); table.row(); Slider maxSpeed = new Slider(minValue, maxValue, step, false, container.skin); maxSpeed.setValue(limiter.getMaxLinearSpeed()); maxSpeed.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { Slider slider = (Slider)actor; limiter.setMaxLinearSpeed(slider.getValue()); labelMaxSpeed.setText("Max.Lin.Speed [" + limiter.getMaxLinearSpeed() + "]"); } }); table.add(maxSpeed); }
Example 12
Source File: SteeringTestBase.java From gdx-ai with Apache License 2.0 | 6 votes |
protected void addMaxAngularAccelerationController (Table table, final Limiter limiter, float minValue, float maxValue, float step) { final Label labelMaxAngAcc = new Label("Max.Ang.Acc.[" + limiter.getMaxAngularAcceleration() + "]", container.skin); table.add(labelMaxAngAcc); table.row(); Slider maxAngAcc = new Slider(minValue, maxValue, step, false, container.skin); maxAngAcc.setValue(limiter.getMaxAngularAcceleration()); maxAngAcc.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { Slider slider = (Slider)actor; limiter.setMaxAngularAcceleration(slider.getValue()); labelMaxAngAcc.setText("Max.Ang.Acc.[" + limiter.getMaxAngularAcceleration() + "]"); } }); table.add(maxAngAcc); }
Example 13
Source File: SteeringTestBase.java From gdx-ai with Apache License 2.0 | 6 votes |
protected void addMaxAngularSpeedController (Table table, final Limiter limiter, float minValue, float maxValue, float step) { final Label labelMaxAngSpeed = new Label("Max.Ang.Speed [" + limiter.getMaxAngularSpeed() + "]", container.skin); table.add(labelMaxAngSpeed); table.row(); Slider maxAngSpeed = new Slider(minValue, maxValue, step, false, container.skin); maxAngSpeed.setValue(limiter.getMaxAngularSpeed()); maxAngSpeed.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { Slider slider = (Slider)actor; limiter.setMaxAngularSpeed(slider.getValue()); labelMaxAngSpeed.setText("Max.Ang.Speed [" + limiter.getMaxAngularSpeed() + "]"); } }); table.add(maxAngSpeed); }
Example 14
Source File: UIUtils.java From uracer-kotd with Apache License 2.0 | 5 votes |
public static Slider newSlider (float min, float max, float step, float value, ChangeListener listener) { Slider s = new Slider(min, max, step, false, Art.scrSkin); s.setValue(value); if (listener != null) { s.addListener(listener); } return s; }
Example 15
Source File: FloatUI.java From gdx-gltf with Apache License 2.0 | 4 votes |
public FloatUI(Skin skin, final float value) { super(skin); slider = new Slider(0, 1, .01f, false, skin); add(slider).row(); slider.setValue(value); }
Example 16
Source File: Scene2dPursueTest.java From gdx-ai with Apache License 2.0 | 4 votes |
@Override public void create () { super.create(); character = new SteeringActor(container.badlogicSmall, false); character.setPosition(MathUtils.random(container.stageWidth), MathUtils.random(container.stageHeight), Align.center); character.setMaxLinearSpeed(100); character.setMaxLinearAcceleration(600); prey = new SteeringActor(container.target, false); prey.setPosition(MathUtils.random(container.stageWidth), MathUtils.random(container.stageHeight), Align.center); prey.setMaxLinearSpeed(100); prey.setMaxLinearAcceleration(250); prey.setMaxAngularAcceleration(0); // used by Wander; set to 0 because independent facing is disabled prey.setMaxAngularSpeed(5); final Pursue<Vector2> pursueSB = new Pursue<Vector2>(character, prey, 0.3f); character.setSteeringBehavior(pursueSB); Wander<Vector2> wanderSB = new Wander<Vector2>(prey) // // Don't use Face internally because independent facing is off .setFaceEnabled(false) // // No need to call setAlignTolerance, setDecelerationRadius and setTimeToTarget for the same reason .setWanderOffset(110) // .setWanderOrientation(10) // .setWanderRadius(64) // .setWanderRate(MathUtils.PI2 * 3.5f); prey.setSteeringBehavior(wanderSB); testTable.addActor(character); testTable.addActor(prey); Table detailTable = new Table(container.skin); detailTable.row(); addMaxLinearAccelerationController(detailTable, character, 0, 2000, 20); detailTable.row(); final Label labelMaxPredictionTime = new Label("Max.Prediction Time[" + pursueSB.getMaxPredictionTime() + "] sec.", container.skin); detailTable.add(labelMaxPredictionTime); detailTable.row(); Slider maxPredictionTime = new Slider(0, 5, .1f, false, container.skin); maxPredictionTime.setValue(pursueSB.getMaxPredictionTime()); maxPredictionTime.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { Slider slider = (Slider)actor; pursueSB.setMaxPredictionTime(slider.getValue()); labelMaxPredictionTime.setText("Max.Prediction Time [" + slider.getValue() + "] sec."); } }); detailTable.add(maxPredictionTime); detailTable.row(); addSeparator(detailTable); detailTable.row(); addMaxLinearSpeedController(detailTable, character, 0, 300, 10); detailWindow = createDetailWindow(detailTable); }