Gdx.input.setInputProcessor(stage); font = new BitmapFont(); skin = new Skin(); buttonAtlas = new TextureAtlas(Gdx.files.internal("buttons/buttons.pack")); skin.addRegions(buttonAtlas);
this.game = game; this.uiStage = new Stage(); this.uiSkin = new Skin();
Skin skin = new Skin("Gdx.files.internal("uiskin.json"), atlas);
Skin textSkin = new Skin(); skin.add("font", textFont);
private void initTouchpad() { skin = new Skin(); skin.add("knob", this.game.manager.get("touchpad/touchKnob.png")); skin.add("background", this.game.manager.get("touchpad/test.png")); style = new TouchpadStyle(); // skin.add style.knob = skin.getDrawable("knob"); style.background = skin.getDrawable("background"); pad = new Touchpad(10, style); pad.setBounds(0, Config.VIRTUAL_VIEW_HEIGHT - 150, 150, 150); } //somewhere in my main this.stage.addActor(pad);
skin = new Skin(); username = new TextField("Username", skin);
Texture bgTexture = new Texture("bg.png"); skin = new Skin(); //empty constructor causes it not to load yet. skin.add("bg", bgTexture); skin.addRegions(textureAtlas); // you will be responsible for disposing the atlas separately from the skin now. skin.load(skinFilePath);
protected void process(List<Integer> chunks) { try { Skin barValue = new Skin(); barValue.setBar( chunks.get(0) ); //System.out.print("PROCESS:" + fileTotalSize + "\n"); } catch (Exception ex) { ex.printStackTrace(); } }
Skin skin = new Skin(); skin.add("background",temp)
Skin skin = new Skin(); skin.addRegions(uiTextureAtlas); TextButton.TextButtonStyle buttonStyle = new TextButton.TextButtonStyle(); buttonStyle.up = skin.getDrawable("textureName"); buttonStyle.font = font; Button button = new Button(buttonStyle); button.addListener(new InputListener() { @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { reset(); return true; } }); button.setSize(100, 100); button.setPosition(300, 400);
Skin theSkin= new Skin(); //Create a button style TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle(); textButtonStyle.pressedOffsetY=-4.0f; textButtonStyle.unpressedOffsetY=-4.0f; theSkin.add("default", textButtonStyle); TextButton theButton = new TextButton("New",theSkin);
skin4 = new Skin(); FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("future.ttf")); FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter(); //change font size here parameter.size = 40; parameter.flip = true; BitmapFont font25 = generator.generateFont(parameter); labelStyle = new Label.LabelStyle(); labelStyle.font = font25; skin4.add("default", labelStyle);
public void show() { buttonsAtlas = new TextureAtlas("spellButton.pack"); //button atlas image buttonSkin = new Skin(); buttonSkin.addRegions(buttonsAtlas); font = new BitmapFont(Gdx.files.internal("WhiteAlpha.fnt"), false); //the font stage = new Stage(); // window is stage stage.clear(); TextButton.TextButtonStyle ribbonStyle = new TextButton.TextButtonStyle(); //Shop title ribbon properties ribbonStyle.up = buttonSkin.getDrawable("ribbon"); ribbonStyle.down = buttonSkin.getDrawable("ribbon"); ribbonStyle.font = font; // change it here (per style) -> ribbonStyle.fontColor = Color.WHITE; ribbon = new TextButton("SHOP", ribbonStyle); //shop title outlook adn textstyle ribbon.setPosition(200, 1720); ribbon.setSize(880, 200); // or, you can change it here (per button) -> ribbon.setColor(Color.WHITE); }
/** * @return the default skin <code>org.apache.maven.skins:maven-default-skin:1.2</code>. */ public static Skin getDefaultSkin() { Skin skin = new Skin(); skin.setGroupId( "org.apache.maven.skins" ); skin.setArtifactId( "maven-default-skin" ); skin.setVersion( "1.2" ); return skin; }
// Create a new skin using the default constructor and // add your fonts to it. Skin skin = new Skin(); skin.add("myFont", myFont, BitmapFont.class); // Remember that this texture atlas is NOT automatically disposed by the skin, // so keep a reference and dispose of it yourself. skin.addRegion(new TextureAtlas("file/location/of/your/atlas"); skin.load(Gdx.files.internal("file/location/of/your/skin"));
stage = new Stage(); Texture bground = new Texture(Gdx.files.internal("pbBackground.png")); Table table = new Table(); table.setFillParent(true); stage.addActor(table); font = new BitmapFont(Gdx.files.internal("gamefonts.fnt")); font.getData().scale(.1f); skin = new Skin(); pixmap = new Pixmap(1, 1, Format.RGBA8888); pixmap.setColor(Color.WHITE); pixmap.fill(); skin.add("white", new Texture(pixmap)); LabelStyle lstyle = new LabelStyle(); lstyle.font=font; Label mylabel = new Label("HP", lstyle); mylabel.setColor(Color.RED); mylabel.setPosition(1, 6); table.addActor(mylabel); textureBar = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("pb.png")))); barStyle = new ProgressBarStyle(skin.newDrawable("white", Color.DARK_GRAY), textureBar); barStyle.background = new TextureRegionDrawable(new TextureRegion(bground)); barStyle.knobBefore=barStyle.knob; bar = new ProgressBar(0, 10, 0.5f, false, barStyle); bar.setPosition(1, 1); bar.setValue(0); bar.setAnimateDuration(2); table.addActor(bar);
Skin skin = new Skin(); skin.add( "background", new NinePatch(this.game.manager.get("hud/ninepatchframe.png", Texture.class), 5, 5, 5, 5)); skin.add("cursor", this.game.manager.get("data/cursor.png")); TextFieldStyle tStyle = new TextFieldStyle(); tStyle.font = getDefaultFont(25); //here i get the font tStyle.fontColor = Color.BLACK; tStyle.background = skin.getDrawable("background"); tStyle.cursor = skin.newDrawable("cursor", Color.GREEN); tStyle.cursor.setMinWidth(2f); tStyle.selection = skin.newDrawable("background", 0.5f, 0.5f, 0.5f, 0.5f); this.nameField = new TextField("enter name here", tStyle);
skin = new Skin();
// do this once, in create() or show() Skin skin = new Skin("uiskin.json"); // get the demo skin from the libgdx test resources Stage stage = new Stage(); Table table = new Table(skin); table.add("Welcome to Slingshot Steve!!!"); table.row(); table.add("Tap anywhere to begin!"); stage.addActor(table); // do this in your render loop stage.act(); stage.draw();
BitmapFont yourBitmapFont = new BitmapFont(); yourBitmapFont.getRegion().getTexture().setFilter(TextureFilter.Linear,TextureFilter.Linear); Skin tileSkin = new Skin(); tileSkin.add("white", new Texture("whatever/image/path")); tileSkin.add("default", new BitmapFont()); TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle(); textButtonStyle.up = tileSkin.newDrawable("white"); textButtonStyle.down = tileSkin.newDrawable("white", Color.DARK_GRAY); textButtonStyle.checked = tileSkin.newDrawable("white", Color.LIGHT_GRAY); textButtonStyle.over = tileSkin.newDrawable("white", Color.LIGHT_GRAY); textButtonStyle.font = _yourBitmapFont; tileSkin.add("default", textButtonStyle);