本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Touchpad.TouchpadStyle类的典型用法代码示例。如果您正苦于以下问题:Java TouchpadStyle类的具体用法?Java TouchpadStyle怎么用?Java TouchpadStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TouchpadStyle类属于com.badlogic.gdx.scenes.scene2d.ui.Touchpad包,在下文中一共展示了TouchpadStyle类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JoystickControl
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad.TouchpadStyle; //导入依赖的package包/类
public JoystickControl(Texture background, Texture knob, float deadZoneRadius, float x, float y, float width, float height) {
touchpadSkin = new Skin();
//Set background image
touchpadSkin.add("touchBackground", background);
//Set knob image
touchpadSkin.add("touchKnob", knob);
//Create TouchPad Style
touchpadStyle = new TouchpadStyle();
//Apply the Drawables to the TouchPad Style
touchpadStyle.background = touchpadSkin.getDrawable("touchBackground");
touchpadStyle.knob = touchpadSkin.getDrawable("touchKnob");
//Create new TouchPad with the created style
touchpad = new Touchpad(deadZoneRadius, touchpadStyle);
//setBounds(x,y,width,height)
touchpad.setBounds(x, y, width, height);
}
示例2: initTouchPad
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad.TouchpadStyle; //导入依赖的package包/类
private void initTouchPad() {
touchpadSkin = new Skin();
touchpadSkin.add("touchBackground", GameUtils.getGame().assetHandler.get("Controls/touchBackground.png",Texture.class));
touchpadSkin.add("touchKnob", GameUtils.getGame().assetHandler.get("Controls/touchKnob.png",Texture.class));
touchpadStyle = new TouchpadStyle();
touchBackground = touchpadSkin.getDrawable("touchBackground");
touchKnob = touchpadSkin.getDrawable("touchKnob");
touchpadStyle.background = touchBackground;
touchpadStyle.knob = touchKnob;
touchpad = new Touchpad(10, touchpadStyle);
touchpad.setBounds(15, 15, 200, 200);
}
示例3: TouchpadEntity
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad.TouchpadStyle; //导入依赖的package包/类
public TouchpadEntity(Stage stage) {
TouchpadStyle style = new TouchpadStyle();
style.background = new TextureRegionDrawable(Drawables.skin("ui/joyBack"));
style.knob = new TextureRegionDrawable(Drawables.skin("ui/joyNub"));
touchpad = new Touchpad(3, style);
touchpad.setBounds(40, 20, SIZE, SIZE);
touchpad.getColor().a = 0;
stage.addActor(touchpad);
Game.publisher().subscribe(this);
Game.publisher().publish(new TouchpadCreatedEvent(touchpad));
}
示例4: createTouchpad
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad.TouchpadStyle; //导入依赖的package包/类
private void createTouchpad() {
stage = new Stage();
TouchpadStyle touchpadStyle = new TouchpadStyle(uiSkin.getDrawable("touchpad-background"), uiSkin.getDrawable("touchpad-knob"));
stick = new Touchpad(1, touchpadStyle);
stick.setBounds(15, 15, 100, 100);
stage.addActor(stick);
}
示例5: createTouchControls
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad.TouchpadStyle; //导入依赖的package包/类
private void createTouchControls(){
logger.info("Creating Touchscreen controls");
touchpadSkin = new Skin();
touchpadSkin.add("touchBackground", App.assets.getTexture("touchBackground.png"));
touchpadSkin.add("touchKnob", App.assets.getTexture("touchKnob.png"));
touchpadStyle = new TouchpadStyle();
touchBackground = touchpadSkin.getDrawable("touchBackground");
touchKnob = touchpadSkin.getDrawable("touchKnob");
touchpadStyle.background = touchBackground;
touchpadStyle.knob = touchKnob;
moveStick = new Touchpad(10, touchpadStyle);
moveStick.setBounds(15, 15, 200, 200);
moveStick.setSize(200, 200);
fireStick = new Touchpad(10, touchpadStyle);
fireStick.setBounds(Gdx.graphics.getWidth() - 215, 15, 200, 200);
fireStick.setSize(200, 200);
//Create a Stage and add TouchPad
//stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true, batch);
stage.addActor(moveStick);
stage.addActor(fireStick);
Gdx.input.setInputProcessor(stage);
}
示例6: resetProperties
import com.badlogic.gdx.scenes.scene2d.ui.Touchpad.TouchpadStyle; //导入依赖的package包/类
public void resetProperties() {
properties.clear();
if (clazz.equals(Button.class)) {
newStyleProperties(ButtonStyle.class);
} else if (clazz.equals(CheckBox.class)) {
newStyleProperties(CheckBoxStyle.class);
properties.get("checkboxOn").optional = false;
properties.get("checkboxOff").optional = false;
properties.get("font").optional = false;
} else if (clazz.equals(ImageButton.class)) {
newStyleProperties(ImageButtonStyle.class);
} else if (clazz.equals(ImageTextButton.class)) {
newStyleProperties(ImageTextButtonStyle.class);
properties.get("font").optional = false;
} else if (clazz.equals(Label.class)) {
newStyleProperties(LabelStyle.class);
properties.get("font").optional = false;
} else if (clazz.equals(List.class)) {
newStyleProperties(ListStyle.class);
properties.get("font").optional = false;
properties.get("fontColorSelected").optional = false;
properties.get("fontColorUnselected").optional = false;
properties.get("selection").optional = false;
} else if (clazz.equals(ProgressBar.class)) {
newStyleProperties(ProgressBarStyle.class);
//Though specified as optional in the doc, there are bugs without "background" being mandatory
properties.get("background").optional = false;
} else if (clazz.equals(ScrollPane.class)) {
newStyleProperties(ScrollPaneStyle.class);
} else if (clazz.equals(SelectBox.class)) {
newStyleProperties(SelectBoxStyle.class);
properties.get("font").optional = false;
properties.get("fontColor").optional = false;
properties.get("scrollStyle").optional = false;
properties.get("scrollStyle").value = "default";
properties.get("listStyle").optional = false;
properties.get("listStyle").value = "default";
} else if (clazz.equals(Slider.class)) {
newStyleProperties(SliderStyle.class);
//Though specified as optional in the doc, there are bugs without "background" being mandatory
properties.get("background").optional = false;
} else if (clazz.equals(SplitPane.class)) {
newStyleProperties(SplitPaneStyle.class);
properties.get("handle").optional = false;
} else if (clazz.equals(TextButton.class)) {
newStyleProperties(TextButtonStyle.class);
properties.get("font").optional = false;
} else if (clazz.equals(TextField.class)) {
newStyleProperties(TextFieldStyle.class);
properties.get("font").optional = false;
properties.get("fontColor").optional = false;
} else if (clazz.equals(TextTooltip.class)) {
newStyleProperties(TextTooltipStyle.class);
properties.get("label").optional = false;
properties.get("label").value = "default";
} else if (clazz.equals(Touchpad.class)) {
newStyleProperties(TouchpadStyle.class);
} else if (clazz.equals(Tree.class)) {
newStyleProperties(TreeStyle.class);
properties.get("plus").optional = false;
properties.get("minus").optional = false;
} else if (clazz.equals(Window.class)) {
newStyleProperties(WindowStyle.class);
properties.get("titleFont").optional = false;
}
}