本文整理匯總了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);
}