List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Skin add
public void add(String name, Object resource)
From source file:com.blackboxgaming.engine.factories.LayerFactory.java
public static Layer createLevelAndHealthLayer() { Stage stage = new Stage(new StretchViewport(486, 864)); Skin skin = new Skin(); Table table = new Table(); table.top().pad(10);//from w w w .j a va 2 s .c om FreeTypeFontGenerator generator = new FreeTypeFontGenerator( Gdx.files.internal("ui/fonts/Century Gothic Bold.ttf")); FreeTypeFontParameter parameter = new FreeTypeFontParameter(); parameter.size = 40; parameter.borderColor = Color.BLACK; parameter.borderWidth = 3; BitmapFont font = generator.generateFont(parameter); generator.dispose(); Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.WHITE); skin.add("star", new Texture("ui/icons/star.png")); skin.add("shield", new Texture("ui/icons/shield.png")); skin.add("brick", new Texture("ui/icons/brick.png")); skin.add("swipe128", new Texture("ui/icons/swipe128.png")); float padding = 10; Image icon = new Image(skin.getDrawable("star")); if (Global.debugLevelUp) { icon.addListener(new ClickListener() { @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { if (Engine.systemManager.has(LevelProgressionSystem.class)) { for (Entity entity : Engine.systemManager.get(LevelProgressionSystem.class).entities) { Engine.garbageManager.markForDeletion(entity); } } super.touchUp(event, x, y, pointer, button); } }); } table.add(icon).pad(padding); Label levelLabel = new Label("", labelStyle); table.add(levelLabel).pad(padding); icon = new Image(skin.getDrawable("shield")); table.add(icon).pad(padding); Label healthLabel = new Label("", labelStyle); table.add(healthLabel).pad(padding); icon = new Image(skin.getDrawable("brick")); table.add(icon).pad(padding); Label brickLabel = new Label("", labelStyle); table.add(brickLabel).pad(padding); table.row(); // swipe if (Engine.systemManager.has(LevelProgressionSystem.class)) { if (Engine.systemManager.get(LevelProgressionSystem.class).level < 5) { icon = new Image(skin.getDrawable("swipe128")); table.add(icon).padTop(350).colspan(6); Global.swipeIcon = icon; } } // table.setDebug(true); table.setFillParent(true); stage.addActor(table); Global.LEVEL_LABEL = levelLabel; Global.HEALTH_LABEL = healthLabel; Global.BRICK_LABEL = brickLabel; if (Engine.systemManager.has(LevelProgressionSystem.class)) { Global.LEVEL_LABEL.setText("" + Engine.systemManager.get(LevelProgressionSystem.class).level); Global.HEALTH_LABEL.setText("" + Engine.systemManager.get(LevelProgressionSystem.class).health); Global.BRICK_LABEL.setText("" + Engine.systemManager.get(LevelProgressionSystem.class).nrOfBricks); } Engine.inputManager.add(stage); return new Layer("topLayer", stage, table); }
From source file:com.blackboxgaming.engine.factories.LayerFactory.java
public static Layer createScoreLayer() { Stage stage = new Stage(); Table table = new Table(); BitmapFont font = new BitmapFont(); font.scale(2);//from w ww . j ava 2 s . c o m Button button; Skin skin = new Skin(); skin.add("bluebox", new Texture("textures/bluebox.jpg")); skin.add("greenbox", new Texture("textures/greenbox.jpg")); skin.add("redbox", new Texture("textures/redbox2.jpg")); ImageTextButtonStyle style = new ImageTextButtonStyle(skin.getDrawable("redbox"), skin.getDrawable("greenbox"), skin.getDrawable("bluebox"), font); button = new ImageTextButton("0", style); button.setHeight(150); button.setWidth(150); button.setName(((ImageTextButton) button).getText().toString()); table.add(button).pad(5).center(); table.pack(); table.setPosition(Gdx.graphics.getWidth() / 2 - table.getWidth() / 2, Gdx.graphics.getHeight() - table.getHeight()); stage.addActor(table); Global.scoreButton = button; return new Layer("scoreLayer", stage); }
From source file:com.blackboxgaming.engine.factories.LayerFactory.java
public static Layer createFireLayer() { Stage stage = new Stage(new StretchViewport(640, 480)); Table table = new Table(); BitmapFont font = new BitmapFont(); Button button;/*from w w w. j av a2 s. c om*/ Skin skin = new Skin(); skin.add("bluebox", new Texture("textures/bluebox.jpg")); skin.add("greenbox", new Texture("textures/greenbox.jpg")); skin.add("redbox", new Texture("textures/redbox.jpg")); ImageTextButtonStyle style = new ImageTextButtonStyle(skin.getDrawable("redbox"), skin.getDrawable("greenbox"), skin.getDrawable("bluebox"), font); button = new ImageTextButton("Fire", style); button.setHeight(50); button.setWidth(50); button.setName(((ImageTextButton) button).getText().toString()); button.addListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { Gdx.input.getInputProcessor().keyDown(Keys.SPACE); return true; } @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { Gdx.input.getInputProcessor().keyUp(Keys.SPACE); } }); table.add(button).pad(50).center(); table.pack(); table.setPosition(640 - table.getWidth(), 0); stage.addActor(table); Engine.inputManager.add(stage); return new Layer("fireLayer", stage); }
From source file:com.blackboxgaming.engine.factories.LayerFactory.java
public static Layer createJoystickLayer() { Stage stage = new Stage(new StretchViewport(1280, 720)); Table table = new Table(); MyListener listener = new MyListener(); BitmapFont font = new BitmapFont(); Button button;//from ww w. ja va 2 s . com Skin skin = new Skin(); skin.add("cirlce", new Texture("textures/circle.png")); ImageTextButtonStyle style = new ImageTextButtonStyle(skin.getDrawable("cirlce"), skin.getDrawable("cirlce"), skin.getDrawable("cirlce"), font); button = new ImageTextButton("Move", style); button.setHeight(150); button.setWidth(150); button.setName(((ImageTextButton) button).getText().toString()); button.addListener(new MoveListener()); table.add(button).pad(50).expandX().left(); button = new ImageTextButton("Fire", style); button.setHeight(150); button.setWidth(150); button.setName(((ImageTextButton) button).getText().toString()); button.addListener(listener); table.add(button).pad(50).bottom().right(); table.setDebug(true); table.setFillParent(true); table.bottom().left(); stage.addActor(table); Engine.inputManager.add(stage); return new Layer("joystickLayer", stage); }
From source file:com.blackboxgaming.engine.factories.LayerFactory.java
public static Layer createJoystickControlLayer() { Stage stage = new Stage(new StretchViewport(1280, 720)); Table table = new Table(); BitmapFont font = new BitmapFont(); Button button;/*from w ww . j av a2 s .c om*/ Skin skin = new Skin(); skin.add("cirlce", new Texture("textures/circle.png")); ImageTextButtonStyle style = new ImageTextButtonStyle(skin.getDrawable("cirlce"), skin.getDrawable("cirlce"), skin.getDrawable("cirlce"), font); button = new ImageTextButton("Debug Options", style); button.setHeight(150); button.setWidth(150); button.setName(((ImageTextButton) button).getText().toString()); button.addListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { Engine.game.setScreen(Engine.screens.get("debug")); return false; } }); table.add(button).pad(50).padLeft(100).expandX().left(); table.row(); button = new ImageTextButton("L Boost", style); button.setHeight(150); button.setWidth(150); button.setName(((ImageTextButton) button).getText().toString()); button.addListener(new Rotate(true, false, true)); table.add(button).pad(50).padLeft(100).expandX().left(); button = new ImageTextButton("R Boost", style); button.setHeight(150); button.setWidth(150); button.setName(((ImageTextButton) button).getText().toString()); button.addListener(new Rotate(false, true, true)); table.add(button).pad(50).padRight(100).bottom().right(); table.row(); button = new ImageTextButton("Left", style); button.setHeight(150); button.setWidth(150); button.setName(((ImageTextButton) button).getText().toString()); button.addListener(new Rotate(true, false, false)); table.add(button).pad(50).padLeft(100).expandX().left(); button = new ImageTextButton("Right", style); button.setHeight(150); button.setWidth(150); button.setName(((ImageTextButton) button).getText().toString()); button.addListener(new Rotate(false, true, false)); table.add(button).pad(50).padRight(100).bottom().right(); // table.setDebug(true); table.setFillParent(true); table.bottom().left(); stage.addActor(table); if (Engine.systemManager.has(OrbitCameraSystem.class) && Engine.systemManager.get(OrbitCameraSystem.class).mouseListener) { InputProcessor tmp = Engine.systemManager.get(OrbitCameraSystem.class).orbitCameraController; Engine.inputManager.remove(tmp); Engine.inputManager.add(stage); Engine.inputManager.add(tmp); } else { Engine.inputManager.add(stage); } return new Layer("controlLayer", stage); }
From source file:com.jupiter.europa.screen.MainMenuScreen.java
License:Open Source License
private static void buildMainMenuSkin() { Skin skin = new Skin(); // Fonts//ww w . j a v a 2 s . com skin.add(BUTTON_FONT_KEY, EuropaGame.game.getAssetManager() .get(FileLocations.FONTS_DIRECTORY.resolve(BUTTON_FONT).toString())); skin.add(TITLE_FANCY_FONT_KEY, EuropaGame.game.getAssetManager() .get(FileLocations.FONTS_DIRECTORY.resolve(TITLE_FANCY_FONT).toString())); skin.add(TITLE_FONT_KEY, EuropaGame.game.getAssetManager() .get(FileLocations.FONTS_DIRECTORY.resolve(TITLE_FONT).toString())); skin.add(LIST_FONT_KEY, EuropaGame.game.getAssetManager().get(FileLocations.FONTS_DIRECTORY.resolve(LIST_FONT).toString())); skin.add(TEXT_FIELD_FONT_KEY, EuropaGame.game.getAssetManager() .get(FileLocations.FONTS_DIRECTORY.resolve(TEXT_FIELD_FONT).toString())); skin.add(INFO_LABEL_FONT_KEY, EuropaGame.game.getAssetManager() .get(FileLocations.FONTS_DIRECTORY.resolve(INFO_LABEL_FONT).toString())); // Set the background texture Pixmap pixmap = new Pixmap(1, (int) 1, Pixmap.Format.RGB888); pixmap.setColor(Color.WHITE); pixmap.fill(); skin.add(SOLID_TEXTURE_KEY, new Texture(pixmap)); Drawable transparentDrawable = skin.newDrawable(SOLID_TEXTURE_KEY, TRANSPARENT); // Get values from the atlas skin.addRegions( EuropaGame.game.getAssetManager().get(MAIN_MENU_SKIN_DIRECTORY.resolve(ATLAS_KEY).toString())); // Colors Color textButtonFontColor = new Color(0.85f, 0.85f, 0.85f, 1.0f); // Set images Drawable textButtonBackground = new TextureRegionDrawable( skin.get(BUTTON_BACKGROUND_KEY, TextureRegion.class)); textButtonBackground.setLeftWidth(32); textButtonBackground.setRightWidth(32); textButtonBackground.setTopHeight(5); textButtonBackground.setBottomHeight(5); skin.add(BUTTON_BACKGROUND_KEY, textButtonBackground); Drawable textButtonBackgroundDown = new TextureRegionDrawable( skin.get(BUTTON_DOWN_KEY, TextureRegion.class)); textButtonBackgroundDown.setLeftWidth(32); textButtonBackgroundDown.setRightWidth(32); textButtonBackgroundDown.setTopHeight(5); textButtonBackgroundDown.setBottomHeight(5); skin.add(BUTTON_DOWN_KEY, textButtonBackgroundDown); Drawable listSelection = new TextureRegionDrawable(skin.get(LIST_SELECTION_KEY, TextureRegion.class)); listSelection.setLeftWidth(7); listSelection.setRightWidth(7); listSelection.setTopHeight(0); listSelection.setBottomHeight(0); skin.add(LIST_SELECTION_KEY, listSelection); Drawable tabButtonBackground = new TextureRegionDrawable( skin.get(TAB_BUTTON_BACKGROUND_KEY, TextureRegion.class)); tabButtonBackground.setLeftWidth(5); tabButtonBackground.setRightWidth(5); tabButtonBackground.setTopHeight(0); tabButtonBackground.setBottomHeight(0); skin.add(TAB_BUTTON_BACKGROUND_KEY, tabButtonBackground); Drawable tabButtonBackgroundSelected = new TextureRegionDrawable( skin.get(TAB_BUTTON_SELECTED_KEY, TextureRegion.class)); tabButtonBackgroundSelected.setLeftWidth(5); tabButtonBackgroundSelected.setRightWidth(5); tabButtonBackgroundSelected.setTopHeight(0); tabButtonBackgroundSelected.setBottomHeight(0); skin.add(TAB_BUTTON_SELECTED_KEY, tabButtonBackgroundSelected); Drawable titleBackground = new TextureRegionDrawable(skin.get(TITLE_BACKGROUND_KEY, TextureRegion.class)); titleBackground.setLeftWidth(10); titleBackground.setRightWidth(10); titleBackground.setTopHeight(0); titleBackground.setBottomHeight(0); skin.add(TITLE_BACKGROUND_KEY, titleBackground); Drawable numberIncreaseDrawable = new TextureRegionDrawable( skin.get(NUMBER_SELECTOR_INCREASE_KEY, TextureRegion.class)); numberIncreaseDrawable.setLeftWidth(0); numberIncreaseDrawable.setRightWidth(0); numberIncreaseDrawable.setTopHeight(0); numberIncreaseDrawable.setBottomHeight(0); skin.add(NUMBER_SELECTOR_INCREASE_KEY, numberIncreaseDrawable); Drawable numberDecreaseDrawable = new TextureRegionDrawable( skin.get(NUMBER_SELECTOR_DECREASE_KEY, TextureRegion.class)); numberDecreaseDrawable.setLeftWidth(0); numberDecreaseDrawable.setRightWidth(0); numberDecreaseDrawable.setTopHeight(0); numberDecreaseDrawable.setBottomHeight(0); skin.add(NUMBER_SELECTOR_DECREASE_KEY, numberDecreaseDrawable); skin.add(DIALOG_BACKGROUND_KEY, skin.newDrawable(new TextureRegionDrawable(skin.get(DIALOG_BACKGROUND_KEY, TextureRegion.class)), new Color(1.0f, 1.0f, 1.0f, 1.0f))); skin.add(POPUP_BACKGROUND_KEY, skin.newDrawable(new TextureRegionDrawable(skin.get(POPUP_BACKGROUND_KEY, TextureRegion.class)), new Color(1.0f, 1.0f, 1.0f, 1.0f))); skin.add(LIST_BACKGROUND_KEY, skin.newDrawable(new TextureRegionDrawable(skin.get(LIST_BACKGROUND_KEY, TextureRegion.class)), new Color(1.0f, 1.0f, 1.0f, 1.0f))); skin.add(LIST_SELECTION_KEY, skin.newDrawable(new TextureRegionDrawable(skin.get(LIST_SELECTION_KEY, TextureRegion.class)), new Color(1.0f, 1.0f, 1.0f, 1.0f))); skin.add(CREDITS_BACKGROUND_KEY, skin.newDrawable(new TextureRegionDrawable(skin.get(CREDITS_BACKGROUND_KEY, TextureRegion.class)), new Color(1.0f, 1.0f, 1.0f, 1.0f))); Drawable dropdownListBackground = skin.newDrawable( new TextureRegionDrawable(skin.get(DROP_DOWN_LIST_BACKGROUND, TextureRegion.class)), new Color(1, 1, 1, 1)); dropdownListBackground.setLeftWidth(28); dropdownListBackground.setRightWidth(28); dropdownListBackground.setTopHeight(0); dropdownListBackground.setBottomHeight(0); skin.add(DROP_DOWN_LIST_BACKGROUND, dropdownListBackground); // Create a Label style for the title Label.LabelStyle titleStyle = new Label.LabelStyle(); titleStyle.background = transparentDrawable; titleStyle.font = skin.getFont(TITLE_FONT_KEY); titleStyle.fontColor = new Color(Color.BLACK); skin.add(DEFAULT_KEY, titleStyle); // Fancy Character Label Style Label.LabelStyle fancyTitleStyle = new Label.LabelStyle(); fancyTitleStyle.background = transparentDrawable; fancyTitleStyle.font = skin.getFont(TITLE_FANCY_FONT_KEY); fancyTitleStyle.fontColor = new Color(Color.BLACK); skin.add(FANCY_KEY, fancyTitleStyle); // Create a Label style for dialogs LabelStyle infoStyle = new LabelStyle(); infoStyle.background = transparentDrawable; infoStyle.font = skin.getFont(INFO_LABEL_FONT_KEY); infoStyle.fontColor = new Color(Color.BLACK); skin.add(INFO_STYLE_KEY, infoStyle); // Default Button Style TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle(); textButtonStyle.up = textButtonBackground; textButtonStyle.down = textButtonBackgroundDown; textButtonStyle.checked = textButtonBackground; textButtonStyle.over = textButtonBackgroundDown; textButtonStyle.disabled = textButtonBackground; textButtonStyle.font = skin.getFont(BUTTON_FONT_KEY); textButtonStyle.fontColor = textButtonFontColor; textButtonStyle.disabledFontColor = new Color(0.3f, 0.3f, 0.3f, 1.0f); // textButtonStyle.pressedOffsetX = 2f; // textButtonStyle.pressedOffsetY = -3f; skin.add(DEFAULT_KEY, textButtonStyle); // Tab Button Style TextButtonStyle tabButtonStyle = new TextButtonStyle(); tabButtonStyle.up = tabButtonBackground; tabButtonStyle.down = tabButtonBackground; tabButtonStyle.checked = tabButtonBackgroundSelected; tabButtonStyle.over = tabButtonBackground; tabButtonStyle.disabled = tabButtonBackground; tabButtonStyle.font = skin.getFont(BUTTON_FONT_KEY); tabButtonStyle.fontColor = textButtonFontColor; tabButtonStyle.overFontColor = textButtonFontColor; tabButtonStyle.disabledFontColor = new Color(Color.GRAY); skin.add(TAB_STYLE_KEY, tabButtonStyle); // Create a TextField style TextFieldStyle textFieldStyle = new TextFieldStyle(); textFieldStyle.background = skin.newDrawable(SOLID_TEXTURE_KEY, new Color(0f, 0f, 0f, 0.1f)); textFieldStyle.selection = skin.newDrawable(SOLID_TEXTURE_KEY, new Color(0f, 0f, 1f, 0.3f)); textFieldStyle.cursor = skin.newDrawable(SOLID_TEXTURE_KEY, Color.BLACK); textFieldStyle.font = skin.getFont(TEXT_FIELD_FONT_KEY); textFieldStyle.fontColor = Color.BLACK; skin.add(DEFAULT_KEY, textFieldStyle); // Create a List style ListStyle listStyle = new ListStyle(); listStyle.font = skin.getFont(LIST_FONT_KEY); listStyle.fontColorSelected = Color.BLACK; listStyle.fontColorUnselected = Color.BLACK; listStyle.selection = listSelection; listStyle.background = transparentDrawable; skin.add(DEFAULT_KEY, listStyle); // Create a Scroll Pane Style ScrollPaneStyle scrollPaneStyle = new ScrollPaneStyle(); scrollPaneStyle.background = transparentDrawable; // scrollPaneStyle.vScroll = skin.newDrawable(MainMenuScreen.SCROLL_BAR_VERTICAL_KEY); // scrollPaneStyle.vScrollKnob = skin.newDrawable(MainMenuScreen.SCROLL_BAR_VERTICAL_KNOB_KEY); skin.add(DEFAULT_KEY, scrollPaneStyle); // Create a Dialog Style WindowStyle dialogStyle = new WindowStyle(); dialogStyle.background = new SpriteDrawable( new Sprite(EuropaGame.game.getAssetManager().get(BACKGROUND_FILE_NAME, Texture.class))); dialogStyle.titleFont = skin.getFont(TITLE_FONT_KEY); dialogStyle.titleFontColor = new Color(Color.BLACK); skin.add(DEFAULT_KEY, dialogStyle); // Popup Dialog Style WindowStyle popupStyle = new WindowStyle(); popupStyle.titleFont = skin.getFont(TITLE_FONT_KEY); popupStyle.titleFontColor = new Color(Color.BLACK); skin.add(POPUP_DIALOG_STYLE_KEY, popupStyle); // Create a Slider Skin SliderStyle sliderStyle = new SliderStyle(); sliderStyle.background = new TextureRegionDrawable(skin.get(SLIDER_BACKGROUND_KEY, TextureRegion.class)); sliderStyle.knob = new TextureRegionDrawable(skin.get(SLIDER_KNOB_KEY, TextureRegion.class)); skin.add(DEFAULT_KEY, sliderStyle); // Create a Drop Down Menu Skin SelectBoxStyle selectBoxStyle = new SelectBoxStyle(); selectBoxStyle.background = textButtonBackground; selectBoxStyle.backgroundOpen = textButtonBackgroundDown; selectBoxStyle.backgroundOver = textButtonBackgroundDown; selectBoxStyle.scrollStyle = scrollPaneStyle; selectBoxStyle.font = skin.getFont(TEXT_FIELD_FONT_KEY); selectBoxStyle.fontColor = textButtonFontColor; ListStyle selectBoxListStyle = new ListStyle(); selectBoxListStyle.font = skin.getFont(LIST_FONT_KEY); selectBoxListStyle.fontColorSelected = textButtonFontColor; selectBoxListStyle.fontColorUnselected = textButtonFontColor; selectBoxListStyle.selection = skin.newDrawable(SOLID_TEXTURE_KEY, SELECTION_COLOR); selectBoxListStyle.background = dropdownListBackground; selectBoxStyle.listStyle = selectBoxListStyle; skin.add(DEFAULT_KEY, selectBoxStyle); // NumberSelectorStyle NumberSelectorStyle numberStyle = new NumberSelectorStyle(); numberStyle.decrease = numberDecreaseDrawable; numberStyle.increase = numberIncreaseDrawable; numberStyle.minimumNumberSize = 50; numberStyle.numberLabelStyle = infoStyle; numberStyle.spacing = COMPONENT_SPACING; skin.add(DEFAULT_KEY, numberStyle); // AttributeSelectorStyle MultipleNumberSelectorStyle attrStyle = new MultipleNumberSelector.MultipleNumberSelectorStyle(); attrStyle.labelStyle = infoStyle; attrStyle.numberSelectorStyle = numberStyle; attrStyle.spacing = COMPONENT_SPACING; skin.add(DEFAULT_KEY, attrStyle); mainMenuSkin = skin; }
From source file:com.jupiter.europa.screen.overlay.PauseMenu.java
License:Open Source License
private static void buildPauseMenuSkin() { Skin skin = new Skin(); skin.add("button-font", EuropaGame.game.getAssetManager() .get(FileLocations.FONTS_DIRECTORY.resolve(BUTTON_FONT).toString())); skin.add("title-font", EuropaGame.game.getAssetManager() .get(FileLocations.FONTS_DIRECTORY.resolve(TITLE_FONT).toString())); // Set the background texture Pixmap pixmap = new Pixmap(1, (int) 1, Pixmap.Format.RGB888); pixmap.setColor(Color.WHITE); pixmap.fill();//from w w w . ja v a 2s.c o m skin.add("background", new Texture(pixmap)); // Create a Label style for the title Label.LabelStyle titleStyle = new Label.LabelStyle(); titleStyle.background = skin.newDrawable("background", TRANSPARENT); titleStyle.font = skin.getFont("title-font"); titleStyle.fontColor = Color.BLACK; skin.add("default", titleStyle); //Create a button style TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle(); textButtonStyle.up = skin.newDrawable("background", TRANSPARENT); textButtonStyle.down = skin.newDrawable("background", TRANSPARENT); textButtonStyle.checked = skin.newDrawable("background", TRANSPARENT); textButtonStyle.over = skin.newDrawable("background", TRANSPARENT); textButtonStyle.disabled = skin.newDrawable("background", TRANSPARENT); textButtonStyle.font = skin.getFont("button-font"); textButtonStyle.fontColor = Color.TEAL; textButtonStyle.overFontColor = Color.YELLOW; textButtonStyle.disabledFontColor = Color.GRAY; textButtonStyle.pressedOffsetX = 2f; textButtonStyle.pressedOffsetY = -3f; skin.add("default", textButtonStyle); // // skin = EmergenceGame.game.getAssetManager().get( // new File(FileLocations.SKINS_DIRECTORY, "main_menu.skin").getPath()); pauseMenuSkin = skin; }
From source file:com.teotigraphix.gdx.app.SkinLibrary.java
License:Apache License
protected void initializeButtonStyle(Skin skin) { ButtonStyle style = new ButtonStyle(); style.up = skin.getDrawable(BUTTON_UP); style.down = skin.getDrawable(BUTTON_DOWN); style.checked = skin.getDrawable(BUTTON_CHECKED); skin.add("default", style); }
From source file:de.cubicvoxel.openspacebox.util.widget.OsbTouchpadStyle.java
License:Open Source License
public OsbTouchpadStyle() { Skin touchpadSkin = new Skin(); touchpadSkin.add("background", OpenSpaceBox.getAsset(TextureAsset.UI_TOUCHPAD_BACKGROUND)); touchpadSkin.add("knob", OpenSpaceBox.getAsset(TextureAsset.UI_TOUCHPAD_KNOB)); background = touchpadSkin.getDrawable("background"); knob = touchpadSkin.getDrawable("knob"); knob.setMinWidth(SIZE * .72f);//w ww. j av a 2 s . c o m knob.setMinHeight(SIZE * .72f); }
From source file:es.eucm.ead.engine.assets.loaders.ExtendedSkinLoader.java
License:Open Source License
@Override public Skin loadSync(AssetManager manager, String fileName, FileHandle file, SkinParameter parameter) { String textureAtlasPath;/*from w w w. jav a2 s . c o m*/ ObjectMap<String, Object> resources; if (parameter == null) { textureAtlasPath = file.pathWithoutExtension() + ".atlas"; resources = null; } else { textureAtlasPath = parameter.textureAtlasPath; resources = parameter.resources; } TextureAtlas atlas = manager.get(textureAtlasPath, TextureAtlas.class); Skin skin = new ExtendedSkin(assets, atlas); if (resources != null) { for (Entry<String, Object> entry : resources.entries()) { skin.add(entry.key, entry.value); } } skin.load(file); return skin; }