當前位置: 首頁>>代碼示例>>Java>>正文


Java Slider類代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Slider的典型用法代碼示例。如果您正苦於以下問題:Java Slider類的具體用法?Java Slider怎麽用?Java Slider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Slider類屬於com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了Slider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addAlbedoRSlider

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
private void addAlbedoRSlider(float w, float h, float scale) {
	lblAR=new Label("Albedo-R:" , skin);
	lblAR.setFontScale(2.5f*scale);
	Table tbRes = new Table();
	tbRes.add(lblAR).height(60*scale);
	tbRes.setPosition(115*scale, h - 140*scale);
	stage.addActor(tbRes);

	albedoRS = new Slider(0, 1, 0.05f, false, skin);
	albedoRS.setValue(pbrShader.albedoColor.x);

	albedoRS.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			pbrShader.albedoColor.x=albedoRS.getValue();
		}
	});

	tbRes = new Table();
	tbRes.add(albedoRS).width((w-150*scale)/3f).height(60*scale);
	tbRes.setPosition(800/3*scale, h - 170*scale);
	stage.addActor(tbRes);
}
 
開發者ID:PWorlds,項目名稱:LibGDX-PBR,代碼行數:24,代碼來源:PBRTestAPP.java

示例2: MenuScreen

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
public MenuScreen(MainGameClass game) {
    this.game = game;

    stage = new Stage(new ScreenViewport());
    Gdx.input.setInputProcessor(stage);

    skin = new Skin(Gdx.files.internal("skins/Flat_Earth_UI_Skin/flatearthui/flat-earth-ui.json"));

    progressBarStyle = skin.get("fancy", ProgressBar.ProgressBarStyle.class);
    TiledDrawable tiledDrawable = skin.getTiledDrawable("slider-fancy-knob").tint(skin.getColor("selection"));
    tiledDrawable.setMinWidth(0);
    progressBarStyle.knobBefore = tiledDrawable;

    sliderStyle = skin.get("fancy", Slider.SliderStyle.class);
    sliderStyle.knobBefore = tiledDrawable;

    layoutTable = new Table();
    layoutTable.top();
    layoutTable.setFillParent(true);
    layoutTable.pad(getPixelSizeFromDensityIndependentPixels(50));
}
 
開發者ID:johannesmols,項目名稱:GangsterSquirrel,代碼行數:22,代碼來源:MenuScreen.java

示例3: addMetallicSlider

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
private void addMetallicSlider(float w, float h, float scale) {
	lblMet=new Label("Metallic:" , skin);
	lblMet.setFontScale(2.5f*scale);
	Table tbRes = new Table();
	tbRes.add(lblMet).height(60*scale);
	tbRes.setPosition(100*scale, h - 20*scale);
	stage.addActor(tbRes);

	metallicS = new Slider(0, 1, 0.05f, false, skin);
	metallicS.setValue(pbrShader.metallicValue);

	metallicS.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			pbrShader.metallicValue=metallicS.getValue();
		}
	});

	tbRes = new Table();
	tbRes.add(metallicS).width(w-50*scale).height(60*scale);
	tbRes.setPosition(800*scale, h - 50*scale);
	stage.addActor(tbRes);
}
 
開發者ID:PWorlds,項目名稱:LibGDX-PBR,代碼行數:24,代碼來源:PBRTestAPP.java

示例4: addAlbedoGSlider

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
private void addAlbedoGSlider(float w, float h, float scale) {
	lblAG=new Label("Albedo-G:" , skin);
	lblAG.setFontScale(2.5f*scale);
	Table tbRes = new Table();
	tbRes.add(lblAG).height(60);
	tbRes.setPosition(115*scale+(w-150*scale)/3f+50*scale, h - 140*scale);
	stage.addActor(tbRes);

	albedoGS = new Slider(0, 1, 0.05f, false, skin);
	albedoGS.setValue(pbrShader.albedoColor.y);

	albedoGS.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			pbrShader.albedoColor.y=albedoGS.getValue();
		}
	});

	tbRes = new Table();
	tbRes.add(albedoGS).width((w-150*scale)/3f).height(60*scale);
	tbRes.setPosition(800*scale/3+(w-150*scale)/3f+50*scale, h - 170*scale);
	stage.addActor(tbRes);
}
 
開發者ID:PWorlds,項目名稱:LibGDX-PBR,代碼行數:24,代碼來源:PBRTestAPP.java

示例5: addAlbedoBSlider

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
private void addAlbedoBSlider(float w, float h, float scale) {
	lblAB=new Label("Albedo-B:" , skin);
	lblAB.setFontScale(2.5f*scale);
	Table tbRes = new Table();
	tbRes.add(lblAB).height(60*scale);
	tbRes.setPosition(115*scale+2*((w-150*scale)/3f+50*scale), h - 140*scale);
	stage.addActor(tbRes);

	albedoBS = new Slider(0, 1, 0.05f, false, skin);
	albedoBS.setValue(pbrShader.albedoColor.z);

	albedoBS.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			pbrShader.albedoColor.z=albedoBS.getValue();
		}
	});

	tbRes = new Table();
	tbRes.add(albedoBS).width((w-150*scale)/3f).height(60*scale);
	tbRes.setPosition(800*scale/3+2*((w-150*scale)/3f+50*scale), h - 170*scale);
	stage.addActor(tbRes);
}
 
開發者ID:PWorlds,項目名稱:LibGDX-PBR,代碼行數:24,代碼來源:PBRTestAPP.java

示例6: addOcclusionlider

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
private void addOcclusionlider(float w, float h, float scale) {
	lblOcl=new Label("Occlusion:" , skin);
	lblOcl.setFontScale(2.5f*scale);
	Table tbRes = new Table();
	tbRes.add(lblOcl).height(60*scale);
	tbRes.setPosition(120*scale, h - 200*scale);
	stage.addActor(tbRes);

	occlusionS = new Slider(0, 1, 0.05f, false, skin);
	occlusionS.setValue(pbrShader.ambientOcclusionValue);

	occlusionS.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			pbrShader.ambientOcclusionValue=occlusionS.getValue();
		}
	});

	tbRes = new Table();
	tbRes.add(occlusionS).width((w-50*scale)).height(60*scale);
	tbRes.setPosition(800*scale, h - 230*scale);
	stage.addActor(tbRes);
}
 
開發者ID:PWorlds,項目名稱:LibGDX-PBR,代碼行數:24,代碼來源:PBRTestAPP.java

示例7: addRougnessSlider

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
private void addRougnessSlider(float w, float h, float scale) {
	lblRoug=new Label("Roughness:" , skin);
	lblRoug.setFontScale(2.5f*scale);
	Table tbRes = new Table();
	tbRes.add(lblRoug).height(120*scale);
	tbRes.setPosition(130*scale, h - 80*scale);
	stage.addActor(tbRes);

	mroughnessS = new Slider(0.6f, 1, 0.01f, false, skin);
	mroughnessS.setValue(pbrShader.rougness);

	mroughnessS.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			pbrShader.rougness=mroughnessS.getValue();
		}
	});

	tbRes = new Table();
	tbRes.add(mroughnessS).width((w-50*scale)).height(60*scale);
	tbRes.setPosition(800*scale, h - 110*scale);
	stage.addActor(tbRes);
}
 
開發者ID:PWorlds,項目名稱:LibGDX-PBR,代碼行數:24,代碼來源:PBRTestAPP.java

示例8: shouldParseSliderBar

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
@Test
@NeedGL
public void shouldParseSliderBar() throws Exception {
    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("slideBar/MainScene.json"), null, null, null, null);

    Group group = editor.createGroup();
    Slider slider = group.findActor("Slider_1");
    assertThat(slider.getWidth(), is(200f));
    assertThat(slider.getHeight(), is(14f));
    assertThat(slider.getValue(), is(50f));
    Slider.SliderStyle style = slider.getStyle();
    assertThat(style.knob, instanceOf(TextureRegionDrawable.class));
    assertThat(style.background, instanceOf(TextureRegionDrawable.class));
    assertThat(style.knobBefore, instanceOf(TextureRegionDrawable.class));
    //assertThat(style.disabledKnob, instanceOf(TextureRegionDrawable.class));
   // assertThat(style.knobDown, instanceOf(TextureRegionDrawable.class));
}
 
開發者ID:varFamily,項目名稱:cocos-ui-libgdx,代碼行數:19,代碼來源:CCSliderTest.java

示例9: LayerController

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
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);
}
 
開發者ID:jsjolund,項目名稱:GdxDemo3D,代碼行數:20,代碼來源:GameStage.java

示例10: AudioOptions

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
public AudioOptions (Skin skin) {
	setName("Audio");
	soundSlider = new Slider(0, 1, 0.05f, false, skin);
	soundSlider.setValue(OrionPrefs.getFloat(FloatValue.AUDIO_SOUND_VOLUME));
	musicSlider = new Slider(0, 1, 0.05f, false, skin);
	musicSlider.setValue(OrionPrefs.getFloat(FloatValue.AUDIO_MUSIC_VOLUME));
	
	musicCheckBox = new CheckBox("Music Enabled", skin);
	musicCheckBox.setChecked(OrionPrefs.getBoolean(BooleanValue.AUDIO_MUSIC_ENABLED));
	soundCheckBox = new CheckBox("Sound Enabled", skin);
	soundCheckBox.setChecked(OrionPrefs.getBoolean(BooleanValue.AUDIO_MUSIC_ENABLED));
	
	Table soundTable = new Table();
	soundTable.add(soundSlider);
	soundTable.add(soundCheckBox);
	
	Table musicTable = new Table();
	musicTable.add(musicSlider);
	musicTable.add(musicCheckBox);
	
	add(soundTable);
	row();
	add(musicTable);
	
}
 
開發者ID:libgdx-jam,項目名稱:GDXJam,代碼行數:26,代碼來源:OptionsDialog.java

示例11: addSlider

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
public Slider addSlider(final int min, final int max, final float x, final float y) {
  Slider _xblockexpression = null;
  {
    final Slider slider = this.addSliderWithoutLabel(min, max, x, y);
    final Label label = this.addLabel((x + 150), (y + 5), ("" + Integer.valueOf(min)));
    final Procedure2<ChangeListener.ChangeEvent, Actor> _function = new Procedure2<ChangeListener.ChangeEvent, Actor>() {
      @Override
      public void apply(final ChangeListener.ChangeEvent $0, final Actor $1) {
        float _value = slider.getValue();
        int _intValue = Float.valueOf(_value).intValue();
        String _plus = ("" + Integer.valueOf(_intValue));
        label.setText(_plus);
      }
    };
    MyChangeListener _myChangeListener = new MyChangeListener(_function);
    slider.addListener(_myChangeListener);
    _xblockexpression = slider;
  }
  return _xblockexpression;
}
 
開發者ID:CymricNPG,項目名稱:abattle,代碼行數:21,代碼來源:Widgets.java

示例12: create

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
@Override
public void create () {
	music = Gdx.audio.newMusic(Gdx.files.internal("data/8.12.mp3"));
	music.play();

	buttons = new TextureRegion(new Texture(Gdx.files.internal("data/playback.png")));
	batch = new SpriteBatch();
	font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);

	stage = new Stage();
	Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
	slider = new Slider(0, 100, 0.1f, false, skin);
	slider.setPosition(200, 20);
	slider.addListener(new ChangeListener() {
		@Override
		public void changed (ChangeEvent event, Actor actor) {
			if (!sliderUpdating && slider.isDragging()) music.setPosition((slider.getValue() / 100f) * songDuration);
		}
	});
	stage.addActor(slider);

	Gdx.input.setInputProcessor(stage);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:24,代碼來源:MusicTest.java

示例13: setup

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
public static void setup(){
	registerSerializer(Actor.class, new ActorSerializer());
	registerSerializer(Scene.class, new SceneSerializer());
	registerSerializer(ImageJson.class, new ImageJson());
	registerSerializer(Label.class, new LabelSerializer());
	registerSerializer(Button.class, new ButtonSerializer());
	registerSerializer(TextButton.class, new TextButtonSerializer());
	registerSerializer(Table.class, new TableSerializer());
	registerSerializer(CheckBox.class, new CheckBoxSerializer());
	registerSerializer(SelectBox.class, new SelectBoxSerializer());
	registerSerializer(List.class, new ListSerializer());
	registerSerializer(Slider.class, new SliderSerializer());
	registerSerializer(TextField.class, new TextFieldSerializer());
	registerSerializer(Touchpad.class, new TouchpadSerializer());
	registerSerializer(Sprite.class, new SpriteSerializer());
	
	registerSerializer(Dialog.class, new DialogSerializer());
	registerSerializer(SplitPane.class, new SplitPaneSerializer());
	registerSerializer(ScrollPane.class, new ScrollPaneSerializer());
	registerSerializer(Stack.class, new StackSerializer());
	registerSerializer(Tree.class, new TreeSerializer());
	registerSerializer(Table.class, new TableSerializer());
	registerSerializer(ButtonGroup.class, new ButtonGroupSerializer());
	registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer());
	registerSerializer(VerticalGroup.class, new VerticalGroupSerializer());
}
 
開發者ID:pyros2097,項目名稱:GdxStudio,代碼行數:27,代碼來源:Serializer.java

示例14: addNormalWidgets

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
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);
}
 
開發者ID:kotcrab,項目名稱:vis-editor,代碼行數:18,代碼來源:TestVertical.java

示例15: addMaxLinearAccelerationController

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入依賴的package包/類
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);
}
 
開發者ID:libgdx,項目名稱:gdx-ai,代碼行數:18,代碼來源:SteeringTestBase.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Slider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。