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


Java Slider.addListener方法代碼示例

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


在下文中一共展示了Slider.addListener方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: addMaxLinearSpeedController

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

示例11: addMaxAngularAccelerationController

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

示例12: addMaxAngularSpeedController

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

示例13: valueTest

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入方法依賴的package包/類
private void valueTest(String label, final ActionHandler<Float> runnable) {
	final Slider sl = new Slider(-100, 100, 0.1f, false, skin);
	sl.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			runnable.run(sl.getValue());
		}
	});
	table.add(label);
	table.add(sl);
	table.row();
}
 
開發者ID:mgsx-dev,項目名稱:gdx-pd,代碼行數:13,代碼來源:PdAudioRemoteTest.java

示例14: makeMusicVolumeSlider

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入方法依賴的package包/類
private Slider makeMusicVolumeSlider() {
	final Slider slider = new Slider(0f, 1f, 0.1f, false, TowerAssetManager.getCustomSkin());
	slider.setValue(DroidTowersGame.getSoundController().getMusicVolume());
	slider.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			DroidTowersGame.getSoundController().setMusicVolume(slider.getValue());
		}
	});
	return slider;
}
 
開發者ID:frigidplanet,項目名稱:droidtowers,代碼行數:12,代碼來源:OptionsDialog.java

示例15: makeSoundEffectsVolumeSlider

import com.badlogic.gdx.scenes.scene2d.ui.Slider; //導入方法依賴的package包/類
private Slider makeSoundEffectsVolumeSlider() {
	final Slider slider = new Slider(0f, 1f, 0.1f, false, TowerAssetManager.getCustomSkin());
	slider.setValue(DroidTowersGame.getSoundController().getEffectsVolume());
	slider.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			preferences.putFloat("effectsVolume", slider.getValue());
			DroidTowersGame.getSoundController().setEffectsVolume(slider.getValue());
		}
	});
	return slider;
}
 
開發者ID:frigidplanet,項目名稱:droidtowers,代碼行數:13,代碼來源:OptionsDialog.java


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