use of de.gurkenlabs.litiengine.resources.SpritesheetResource in project litiengine by gurkenlabs.
the class AssetPanelItem method canAdd.
private boolean canAdd() {
if (this.getOrigin() instanceof SpritesheetResource) {
SpritesheetResource info = (SpritesheetResource) this.getOrigin();
String propName = PropPanel.getIdentifierBySpriteName(info.getName());
return propName != null && !propName.isEmpty() || CreaturePanel.getCreatureSpriteName(info.getName()) != null;
}
return this.getOrigin() instanceof MapObject || this.getOrigin() instanceof EmitterData;
}
use of de.gurkenlabs.litiengine.resources.SpritesheetResource in project litiengine by gurkenlabs.
the class AssetPanel method loadSprites.
public void loadSprites(List<SpritesheetResource> infos) {
this.load(() -> {
Collections.sort(infos);
for (SpritesheetResource info : infos) {
Icon icon;
Spritesheet opt = Resources.spritesheets().get(info.getName());
if (opt != null && opt.getSprite(0) != null) {
icon = new ImageIcon(Imaging.scale(opt.getSprite(0), 64, 64, true));
} else {
icon = null;
}
AssetPanelItem panelItem = new AssetPanelItem(icon, getResourceNameWithoutPrefix(info), info);
this.add(panelItem);
panelItem.validate();
}
});
}
Aggregations