当前位置: 首页>>代码示例>>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;未经允许,请勿转载。