Search in sources :

Example 11 with SpritesheetResource

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;
}
Also used : SpritesheetResource(de.gurkenlabs.litiengine.resources.SpritesheetResource) MapObject(de.gurkenlabs.litiengine.environment.tilemap.xml.MapObject) IMapObject(de.gurkenlabs.litiengine.environment.tilemap.IMapObject) EmitterData(de.gurkenlabs.litiengine.graphics.emitters.xml.EmitterData)

Example 12 with SpritesheetResource

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();
        }
    });
}
Also used : SpritesheetResource(de.gurkenlabs.litiengine.resources.SpritesheetResource) ImageIcon(javax.swing.ImageIcon) Spritesheet(de.gurkenlabs.litiengine.graphics.Spritesheet) Icon(javax.swing.Icon) ImageIcon(javax.swing.ImageIcon)

Aggregations

SpritesheetResource (de.gurkenlabs.litiengine.resources.SpritesheetResource)12 Blueprint (de.gurkenlabs.litiengine.environment.tilemap.xml.Blueprint)7 Spritesheet (de.gurkenlabs.litiengine.graphics.Spritesheet)6 IMapObject (de.gurkenlabs.litiengine.environment.tilemap.IMapObject)4 MapObject (de.gurkenlabs.litiengine.environment.tilemap.xml.MapObject)4 EmitterData (de.gurkenlabs.litiengine.graphics.emitters.xml.EmitterData)4 File (java.io.File)3 ArrayList (java.util.ArrayList)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 IImageLayer (de.gurkenlabs.litiengine.environment.tilemap.IImageLayer)2 ITileset (de.gurkenlabs.litiengine.environment.tilemap.ITileset)2 ImageFormat (de.gurkenlabs.litiengine.resources.ImageFormat)2 Game (de.gurkenlabs.litiengine.Game)1 EmitterMapObjectLoader (de.gurkenlabs.litiengine.environment.EmitterMapObjectLoader)1 Environment (de.gurkenlabs.litiengine.environment.Environment)1 IMapObjectLayer (de.gurkenlabs.litiengine.environment.tilemap.IMapObjectLayer)1 MapObjectProperty (de.gurkenlabs.litiengine.environment.tilemap.MapObjectProperty)1 MapObjectType (de.gurkenlabs.litiengine.environment.tilemap.MapObjectType)1 MapRenderer (de.gurkenlabs.litiengine.environment.tilemap.MapRenderer)1 MapObjectLayer (de.gurkenlabs.litiengine.environment.tilemap.xml.MapObjectLayer)1