List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ImageButton getImageCell
public Cell getImageCell()
From source file:com.andgate.ikou.utility.Icon.java
License:Open Source License
public static ImageButton createIconButton(Ikou game, String upFilename, String downFilename, ClickListener listener) {/*from w ww .jav a 2 s . c o m*/ Texture buttonTexture = new Texture(Gdx.files.internal(upFilename), true); buttonTexture.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.Linear); Texture buttonDownTexture = new Texture(Gdx.files.internal(downFilename), true); buttonDownTexture.setFilter(TextureFilter.MipMapLinearLinear, TextureFilter.Linear); TextureRegionDrawable buttonDrawable = new TextureRegionDrawable(new TextureRegion(buttonTexture)); TextureRegionDrawable buttonDownDrawable = new TextureRegionDrawable(new TextureRegion(buttonDownTexture)); ImageButton button = new ImageButton(buttonDrawable, buttonDownDrawable); button.getImageCell().width(Constants.BUTTON_LENGTH * game.ppm); button.getImageCell().height(Constants.BUTTON_LENGTH * game.ppm); button.addListener(listener); return button; }
From source file:com.andgate.pokeadot.PokeADot.java
License:Open Source License
public ImageButton createIconButton(String upFilename, String downFilename, ClickListener listener) { Texture buttonTexture = new Texture(upFilename); buttonTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); Texture buttonDownTexture = new Texture(upFilename); buttonDownTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); TextureRegionDrawable buttonDrawable = new TextureRegionDrawable(new TextureRegion(buttonTexture)); TextureRegionDrawable buttonDownDrawable = new TextureRegionDrawable(new TextureRegion(buttonDownTexture)); ImageButton button = new ImageButton(buttonDrawable, buttonDownDrawable); button.getImageCell().width(Constants.BUTTON_LENGTH * ppm); button.getImageCell().height(Constants.BUTTON_LENGTH * ppm); button.addListener(listener);//from www . ja v a2s . c o m return button; }