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


Java Skin.getDrawable方法代碼示例

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

}
 
開發者ID:DurianHLN,項目名稱:Polymorph,代碼行數:25,代碼來源:DeathScreen.java

示例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());
        }
    });
}
 
開發者ID:ZephyrVentum,項目名稱:FlappySpinner,代碼行數:24,代碼來源:GameButton.java

示例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);
    }
 
開發者ID:ezet,項目名稱:penguins-in-space,代碼行數:32,代碼來源:GamepadController.java

示例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);
	
}
 
開發者ID:Arcxes,項目名稱:CursedEcho,代碼行數:14,代碼來源:CursedEchoController.java

示例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;
}
 
開發者ID:raeleus,項目名稱:bobbybird,代碼行數:16,代碼來源:LoadingState.java

示例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);

}
 
開發者ID:MSLacerda,項目名稱:DarkDay,代碼行數:16,代碼來源:TouchPadConf.java

示例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);
}
 
開發者ID:raeleus,項目名稱:bobbybird,代碼行數:5,代碼來源:BouncingImage.java


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