本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Skin.getDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java Skin.getDrawable方法的具体用法?Java Skin.getDrawable怎么用?Java Skin.getDrawable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.Skin
的用法示例。
在下文中一共展示了Skin.getDrawable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initButtons
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
public void initButtons(int score,TextureAtlas buttonAtlas) {
Skin buttonSkin = new Skin();
buttonSkin.addRegions(buttonAtlas);
//TODO FIX THIS SHIT INDENTATION
//TODO Long-term fix the magic numbers
ImageButton playButton = new ImageButton(buttonSkin.getDrawable("playbutton"),
buttonSkin.getDrawable("playbutton"));
playButton.setSize(256, 64);
playButton.setPosition(screenSize.width/2-playButton.getWidth()/2,
screenSize.height/2-playButton.getHeight()/2+50);
playButton.addListener(new InputListener() {
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
polymorph.setScreen(new GameScreen(polymorph));
DeathScreenMusic.stop();
return true;
}
});
stage.addActor(playButton);
}
示例2: GameButton
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
public GameButton(float WIDTH, float HEIGHT, String drawable, boolean isCheckable) {
audioManager = AudioManager.getInstance();
skin = new Skin();
skin.addRegions(AssetsManager.getTextureAtlas());
Button.ButtonStyle buttonStyle = new Button.ButtonStyle();
buttonStyle.up = skin.getDrawable(drawable);
buttonStyle.down = skin.getDrawable(drawable + "_pressed");
if (isCheckable) {
buttonStyle.checked = skin.getDrawable(drawable + "_pressed");
}
setStyle(buttonStyle);
setSize(WIDTH, HEIGHT);
rectangle = new Rectangle(getX(),getY(),getWidth(),getHeight());
addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
audioManager.playSound(audioManager.getButtonSound());
}
});
}
示例3: initTouchpad
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
private void initTouchpad() {
// TODO: use uiskin.json
// Skin touchpadSkin = new Skin(Gdx.files.internal("data/uiskin.json"));
Skin touchpadSkin = new Skin();
touchpadSkin.add("touchBackground", assetService.getTexture(TOUCH_BACKGROUND));
touchpadSkin.add("touchKnob", assetService.getTexture(TOUCH_KNOB));
Touchpad.TouchpadStyle style = new Touchpad.TouchpadStyle();
style.background = touchpadSkin.getDrawable("touchBackground");
style.knob = touchpadSkin.getDrawable("touchKnob");
style.knob.setMinHeight(TOUCHPAD_SIZE / 2);
style.knob.setMinWidth(TOUCHPAD_SIZE / 2);
touchPad = new Touchpad(15, style);
touchPad.setBounds(TOUCHPAD_MARGIN, TOUCHPAD_MARGIN, TOUCHPAD_SIZE, TOUCHPAD_SIZE);
addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
}
});
NoClickZone padZone = new NoClickZone(touchPad, NO_CLICK_MARGIN);
addActor(padZone);
touchpadSkin.add("touchButton", assetService.getTexture(TOUCH_KNOB));
button = new GamepadButton(touchpadSkin.getDrawable("touchButton"));
button.setSize(BUTTON_SIZE, BUTTON_SIZE);
NoClickZone buttonZone = new NoClickZone(button, NO_CLICK_MARGIN);
addActor(buttonZone);
}
示例4: initTouchPad
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的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);
}
示例5: createSkin
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
private Skin createSkin() {
Skin returnValue = new Skin();
returnValue.add("bg", createDrawable(20, 20, Color.DARK_GRAY), Drawable.class);
returnValue.add("progress-bar-back", createDrawable(20, 20, Color.BLACK), Drawable.class);
returnValue.add("progress-bar", createDrawable(1, 20, Color.BLUE), Drawable.class);
ProgressBarStyle progressBarStyle = new ProgressBarStyle();
progressBarStyle.background = returnValue.getDrawable("progress-bar-back");
progressBarStyle.knobBefore = returnValue.getDrawable("progress-bar");
returnValue.add("default-horizontal", progressBarStyle);
return returnValue;
}
示例6: touchPadConf
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
public void touchPadConf() {
touchpadSkin = new Skin();
touchpadSkin.add("touchpadBackground", new Texture("touchpadBackground.png"));
touchpadSkin.add("touchKnob", new Texture("touchKnob.png"));
touchpadStyle = new Touchpad.TouchpadStyle();
touchpadBackground = touchpadSkin.getDrawable("touchpadBackground");
touchpadKnob = touchpadSkin.getDrawable("touchKnob");
touchpadStyle.background = touchpadBackground;
touchpadStyle.knob = touchpadKnob;
touchpad = new Touchpad(20, touchpadStyle);
touchpad.setBounds(15, 15 ,150, 150);
}
示例7: BouncingImage
import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
/** Creates an image stretched, and aligned center. */
public BouncingImage (Skin skin, String drawableName) {
this(skin.getDrawable(drawableName), Scaling.stretch, Align.center);
}