Gdx.input.setInputProcessor(stage); font = new BitmapFont(); skin = new Skin(); buttonAtlas = new TextureAtlas(Gdx.files.internal("buttons/buttons.pack")); skin.addRegions(buttonAtlas); textButtonStyle = new TextButtonStyle(); textButtonStyle.font = font; textButtonStyle.up = skin.getDrawable("up-button"); textButtonStyle.down = skin.getDrawable("down-button"); textButtonStyle.checked = skin.getDrawable("checked-button"); button = new TextButton("Button1", textButtonStyle); stage.addActor(button);
skin = Skin.getDefaultSkin(); String version = skin.getVersion(); Artifact artifact; try artifact = artifactFactory.createDependencyArtifact( skin.getGroupId(), skin.getArtifactId(), versionSpec, "jar", null, null );
/** * Method equals. * * @param other * @return boolean */ public boolean equals( Object other ) { if ( this == other ) { return true; } if ( !( other instanceof Skin ) ) { return false; } Skin that = (Skin) other; boolean result = true; result = result && ( getGroupId() == null ? that.getGroupId() == null : getGroupId().equals( that.getGroupId() ) ); result = result && ( getArtifactId() == null ? that.getArtifactId() == null : getArtifactId().equals( that.getArtifactId() ) ); result = result && ( getVersion() == null ? that.getVersion() == null : getVersion().equals( that.getVersion() ) ); return result; } //-- boolean equals( Object )
throws MojoExecutionException final Skin skin = Skin.getDefaultSkin(); final String version = determineVersion(skin); try VersionRange.createFromVersionSpec(version); final Artifact artifact = factory.createDependencyArtifact(skin.getGroupId(), skin.getArtifactId(), versionSpec, "jar", null, null); resolver.resolve(artifact, project.getRemoteArtifactRepositories(), localRepository);
Skin textSkin = new Skin(); skin.add("font", textFont);
/** * @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"));
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);
skinButton=new Skin(); buttonAtlas = new TextureAtlas("img/sprites/buttons/button.txt"); skinButton.addRegions(buttonAtlas); textButtonStyle = new TextButton.TextButtonStyle(); textButtonStyle.font = font; textButtonStyle.up = skinButton.getDrawable("rounded_rectangle_button"); textButtonStyle.down = skinButton.getDrawable("rounded_rectangle_button"); textButtonStyle.checked = skinButton.getDrawable("rounded_rectangle_button"); button=new TextButton("Finish",textButtonStyle); button.setText("Finish"); buttonAtlas.dispose(); font.dispose(); skinButton.dispose(); buttonAtlas.dispose(); batch.dispose();
/** * Determines the version of the given skin. If the version is not set in the * skin, the {@link Artifact#RELEASE_VERSION} is returned. * * @param skin the skin whose version is requested. * @return the version of the skin or {@link Artifact#RELEASE_VERSION} as * default. */ private static String determineVersion(final Skin skin) { String version = skin.getVersion(); if (version == null) { version = Artifact.RELEASE_VERSION; } return version; }
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);
skin = Skin.getDefaultSkin(); String version = skin.getVersion(); Artifact artifact; try artifact = artifactFactory.createDependencyArtifact( skin.getGroupId(), skin.getArtifactId(), versionSpec, "jar", null, null );
/** * Method toString. * * @return String */ public java.lang.String toString() { StringBuilder buf = new StringBuilder( 128 ); buf.append( "groupId = '" ); buf.append( getGroupId() ); buf.append( "'" ); buf.append( "\n" ); buf.append( "artifactId = '" ); buf.append( getArtifactId() ); buf.append( "'" ); buf.append( "\n" ); buf.append( "version = '" ); buf.append( getVersion() ); buf.append( "'" ); return buf.toString(); } //-- java.lang.String toString()
Skin skin = new Skin("Gdx.files.internal("uiskin.json"), atlas);
Skin skin = new Skin(); for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) skin.setGroupId( getTrimmedValue( parser.nextText() ) ); skin.setArtifactId( getTrimmedValue( parser.nextText() ) ); skin.setVersion( getTrimmedValue( parser.nextText() ) );
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);