Package transientlibs.preui.objects.gui.misc

Source Code of transientlibs.preui.objects.gui.misc.ImageSections

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package transientlibs.preui.objects.gui.misc;

import com.badlogic.gdx.graphics.g2d.TextureRegion;
import java.util.ArrayList;
import transientlibs.bindedobjects.gamecontent.Terrain;
import transientlibs.processors.misc.Detonator;
import transientlibs.objects.general.ImageSlot;
import transientlibs.preui.objects.gui.elements.TransientGDXImage;
import transientlibs.preui.objects.gui.interfaces.IImage;

/**
*
* @author kibertoad
*/
public class ImageSections extends ArrayList<ArrayList<ImageSlot>>{
   
   
    public void setSection (int onX, int onY, IImage toImage) {
        while (this.size() <= onY) {
            add(new ArrayList<ImageSlot>());
        }

        while (this.get(onY).size() <= onX) {
            this.get(onY).add(new ImageSlot());
        }
       
        this.get(onY).get(onX).referencedImages = toImage;
    }
   
    public void cutFromImage (IImage image) {
        int tileSizeX = Terrain.tileWidth;
        int tileSizeY = Terrain.tileHeight;
       
        //ImageSlot currentSlot = new ImageSlot();
        //IImage currentImage = image.getSubImage (0, tileSizeX, 0, tileSizeY);
       
        TextureRegion[][] tiles = image.getAtlasRegion().split(tileSizeX, tileSizeY);


       
        for (int x = 0; x < tiles.length; x++) {
                    for (int y = 0; y < tiles[x].length; y++) {
            setSection (x, y, new TransientGDXImage (tiles[x][y]));
        }
        }
       
        this.add(null);
    }
   
   
}
TOP

Related Classes of transientlibs.preui.objects.gui.misc.ImageSections

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.