当前位置: 首页>>代码示例>>Java>>正文


Java Skin.addRegions方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Skin.addRegions方法的典型用法代码示例。如果您正苦于以下问题:Java Skin.addRegions方法的具体用法?Java Skin.addRegions怎么用?Java Skin.addRegions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.ui.Skin的用法示例。


在下文中一共展示了Skin.addRegions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createSkin

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
public static Skin createSkin(final String atlasFile, final String jsonFile) {
    Skin skin = new Skin();

    // load texture atlas
    TextureAtlas atlas = new TextureAtlas(Gdx.files.absolute(atlasFile));
    skin.addRegions(atlas);

    // load skin json file
    skin.load(Gdx.files.absolute(jsonFile));

    return skin;
}
 
开发者ID:opensourcegamedev,项目名称:SpaceChaos,代码行数:13,代码来源:SkinFactory.java

示例4: createSkin

import com.badlogic.gdx.scenes.scene2d.ui.Skin; //导入方法依赖的package包/类
public static void createSkin(){
    
    
    fontHemi10 = createFont(10 , Fonts.HEMI_HEAD);
    fontHemi12 = createFont(12 , Fonts.HEMI_HEAD);
    fontHemi16 = createFont(16 , Fonts.HEMI_HEAD);
    fontHemi18 = createFont(18, Fonts.HEMI_HEAD);
    
    fontVeraRg10 = createFont(10 , Fonts.VERA);
    fontVeraBd16 = createFont(16, Fonts.VERA_BD);
    fontHemi20 = createFont(20,Fonts.HEMI_HEAD);
    fontVeraRg20 = createFont(20, Fonts.VERA);
    fontVeraBd20 = createFont(20, Fonts.VERA_BD);
    fontHemi24 = createFont(24 ,Fonts.HEMI_HEAD);
    fontVeraRg24 = createFont(24, Fonts.VERA);
    fontVeraBd24 = createFont(24, Fonts.VERA_BD);
    Skin skin = new Skin();
    TextureAtlas atlas = new TextureAtlas("interface/ui/atlas-ui.txt");
    skin.addRegions(atlas);
    
    skin.add("fontVeraRg10", Assets.fontVeraRg10);
    skin.add("fontHemi10", Assets.fontHemi10);
    skin.add("fontHemi12", Assets.fontHemi12);
    skin.add("default-font", Assets.fontHemi16);
    skin.add("fontVeraBd16", Assets.fontVeraBd16);
    skin.add("fontHemi18", Assets.fontHemi18);
    skin.add("fontHemi20", Assets.fontHemi20);
    skin.add("fontVeraBd20", Assets.fontVeraBd20);
    skin.add("fontVeraRg20", fontVeraRg20);
    skin.add("fontHemi24", Assets.fontHemi24);
    skin.add("fontVeraRg24", Assets.fontVeraRg24);
    skin.add("fontVeraBd24", Assets.fontVeraBd24);
    skin.load(Gdx.files.internal("interface/ui/uiSkin.json"));
    _skin = skin;
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:36,代码来源:Assets.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Skin.addRegions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。