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