use of com.badlogic.gdx.graphics.g2d.Sprite in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnNotAliasWhenAtlasRegionsAreNotEqual.
@Test
public void shouldReturnNotAliasWhenAtlasRegionsAreNotEqual() {
Sprite sprite1 = new AtlasSprite(new AtlasRegion(texture512x512, 50, 30, 40, 40));
Sprite sprite2 = new AtlasSprite(new AtlasRegion(texture512x512, 50, 30, 20, 40));
assertFalse(SpriteUtils.isAliasSprite(sprite1, sprite2));
}
use of com.badlogic.gdx.graphics.g2d.Sprite in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnIsAliasWhenRegionEquals.
@Test
public void shouldReturnIsAliasWhenRegionEquals() {
TextureRegion region1 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
TextureRegion region2 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
Sprite sprite1 = new Sprite(region1);
Sprite sprite2 = new Sprite(region2);
assertTrue(SpriteUtils.isAliasSprite(sprite1, sprite2));
}
use of com.badlogic.gdx.graphics.g2d.Sprite in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnFalseIfSpriteNull.
@Test
public void shouldReturnFalseIfSpriteNull() {
TextureRegion region1 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
Sprite sprite1 = new Sprite(region1);
assertFalse(SpriteUtils.isAliasSprite(sprite1, null));
assertFalse(SpriteUtils.isAliasSprite(null, sprite1));
}
use of com.badlogic.gdx.graphics.g2d.Sprite in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnAliasWhenAtlasRegionsAreEqual.
@Test
public void shouldReturnAliasWhenAtlasRegionsAreEqual() {
AtlasRegion atlasRegion1 = new AtlasRegion(texture512x512, 50, 30, 40, 40);
AtlasRegion atlasRegion2 = new AtlasRegion(texture512x512, 50, 30, 40, 40);
Sprite sprite1 = new AtlasSprite(atlasRegion1);
Sprite sprite2 = new AtlasSprite(atlasRegion2);
assertTrue(SpriteUtils.isAliasSprite(sprite1, sprite2));
}
use of com.badlogic.gdx.graphics.g2d.Sprite in project Entitas-Java by Rubentxu.
the class SMGUIManager method createSkin.
public Skin createSkin(BaseAssetsManager assetsManager) {
defaultFont = assetsManager.getFont(DEFAULT_FONT);
defaultFont.getData().setScale(ScaleUtil.getSizeRatio());
defaultFont.setUseIntegerPositions(false);
font2 = assetsManager.getFont(HEADER_FONT);
font2.getData().setScale(ScaleUtil.getSizeRatio());
font2.setUseIntegerPositions(false);
skin.add("default", defaultFont);
skin.add("header", font2);
skin.add("lt-blue", new Color(.62f, .76f, .99f, 1f));
skin.add("lt-green", new Color(.39f, .9f, .6f, 1f));
skin.add("dark-blue", new Color(.79f, .95f, 91f, 1f));
skin.addRegions(assetsManager.getTextureAtlas(GUI_ATLAS));
skin.addRegions(assetsManager.getTextureAtlas(GUI_PACK_ATLAS));
TextureRegionDrawable touchpad_background = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(GUI_ATLAS)).findRegion("touchpad_background"));
TextureRegionDrawable touchpad_thumb = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(GUI_ATLAS)).findRegion("touchpad_thumb"));
TextureRegionDrawable checkox_true = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(UISKIN_ATLAS)).findRegion("check-on"));
TextureRegionDrawable checkox_false = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(UISKIN_ATLAS)).findRegion("check-off"));
TextureRegionDrawable slider_knob = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(UISKIN_ATLAS)).findRegion("default-slider-knob"));
TextureRegionDrawable slider = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(UISKIN_ATLAS)).findRegion("default-slider"));
CheckBox.CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle(checkox_false, checkox_true, defaultFont, Color.WHITE);
SpriteDrawable stats = new SpriteDrawable(new Sprite((Texture) assetsManager.getTexture(STATS_BACKGROUND)));
Slider.SliderStyle sliderStyle = new Slider.SliderStyle(slider, slider_knob);
skin.add("default", new Window.WindowStyle(font2, Color.ORANGE, skin.getDrawable("debug")));
skin.add("stats", stats);
Label.LabelStyle lbs = new Label.LabelStyle();
lbs.font = defaultFont;
lbs.fontColor = Color.WHITE;
skin.add("default", lbs);
Label.LabelStyle lbsHeader = new Label.LabelStyle();
lbsHeader.font = font2;
lbsHeader.fontColor = Color.WHITE;
skin.add("header", lbsHeader);
TextButton.TextButtonStyle tbs = new TextButton.TextButtonStyle(skin.getDrawable("btnMenu"), skin.getDrawable("btnMenuPress"), skin.getDrawable("btnMenu"), defaultFont);
tbs.fontColor = skin.getColor("dark-blue");
tbs.pressedOffsetX = Math.round(1f * Gdx.graphics.getDensity());
tbs.pressedOffsetY = tbs.pressedOffsetX * -1f;
ImageButton.ImageButtonStyle ImageButtonLeft = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonLeft"), skin.getDrawable("buttonLeftPress"), skin.getDrawable("buttonLeft"), null, null, null);
ImageButton.ImageButtonStyle ImageButtonRight = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonRight"), skin.getDrawable("buttonRightPress"), skin.getDrawable("buttonRight"), null, null, null);
ImageButton.ImageButtonStyle ImageButtonUp = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonUp"), skin.getDrawable("buttonUpPress"), skin.getDrawable("buttonUp"), null, null, null);
Touchpad.TouchpadStyle touchpadStyle = new Touchpad.TouchpadStyle();
touchpadStyle.background = touchpad_background;
touchpadStyle.knob = touchpad_thumb;
skin.add("default", tbs);
skin.add("buttonLeft", ImageButtonLeft);
skin.add("buttonRight", ImageButtonRight);
skin.add("buttonUp", ImageButtonUp);
skin.add("default", touchpadStyle);
skin.add("default", checkBoxStyle);
skin.add("default-horizontal", sliderStyle);
return skin;
}
Aggregations