Class ImageCell


  • public class ImageCell
    extends java.lang.Object
    This class manages and holds tileset and all matrices of images to be pained
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.HashMap<java.lang.String,​java.lang.Integer> cellMap  
      private static java.awt.image.BufferedImage image  
      private ImageDoor imageDoor  
      private java.util.LinkedList<java.awt.image.BufferedImage> imagesOfItems  
      private java.util.LinkedList<java.awt.image.BufferedImage> imagesOfTiles  
      private static java.util.logging.Logger LOG  
      private int[][] mapBackground  
      private int[][] mapForeground  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageCell()  
    • Method Summary

      Modifier and Type Method Description
      ImageDoor getImageDoor()  
      int getImageFromCellMap​(java.lang.String cell)  
      java.util.LinkedList<java.awt.image.BufferedImage> getImagesOfItems()  
      java.util.LinkedList<java.awt.image.BufferedImage> getImagesOfTiles()  
      int[][] getMapBackground()  
      int[][] getMapForeground()  
      void imageItem​(java.lang.String itemInfo)
      Parses item image into array
      void imageObjectset​(java.lang.String file)
      Parses (map-name)-objectset.txt file into a matrix
      void imageTileset​(java.lang.String[] tilesetInfo)
      Parses tileset image into a tileset (array)
      void loadCellMap​(java.lang.String[] cellInfo)
      Parses text into a hash map
      void paintBackground​(java.awt.Graphics g, int x, int y)  
      void paintForeground​(java.awt.Graphics g, int x, int y)  
      void readMapFile​(int width, int height)
      Creates new matrices based on width and height values
      void readMapFile​(java.lang.String name)
      Reads and parses (map-name)-tileset.txt file into matrices and arrays, separates values and passes them on for further parsing
      void setMapBackground​(int[][] mapBackground)  
      void setMapForeground​(int[][] mapForeground)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • image

        private static java.awt.image.BufferedImage image
      • imagesOfTiles

        private java.util.LinkedList<java.awt.image.BufferedImage> imagesOfTiles
      • cellMap

        private java.util.HashMap<java.lang.String,​java.lang.Integer> cellMap
      • imagesOfItems

        private java.util.LinkedList<java.awt.image.BufferedImage> imagesOfItems
      • mapBackground

        private int[][] mapBackground
      • mapForeground

        private int[][] mapForeground
      • LOG

        private static final java.util.logging.Logger LOG
    • Constructor Detail

      • ImageCell

        public ImageCell()
    • Method Detail

      • readMapFile

        public void readMapFile​(int width,
                                int height)
        Creates new matrices based on width and height values
        Parameters:
        width - is width of new map
        height - is height of new map
      • readMapFile

        public void readMapFile​(java.lang.String name)
        Reads and parses (map-name)-tileset.txt file into matrices and arrays, separates values and passes them on for further parsing
        Parameters:
        name - is name of map file
      • imageTileset

        public void imageTileset​(java.lang.String[] tilesetInfo)
        Parses tileset image into a tileset (array)
        Parameters:
        tilesetInfo - is name of tileset image
      • imageObjectset

        public void imageObjectset​(java.lang.String file)
        Parses (map-name)-objectset.txt file into a matrix
        Parameters:
        file - is name of map tp be parsed
      • loadCellMap

        public void loadCellMap​(java.lang.String[] cellInfo)
        Parses text into a hash map
        Parameters:
        cellInfo - is text representation of cellMap
      • imageItem

        public void imageItem​(java.lang.String itemInfo)
        Parses item image into array
        Parameters:
        itemInfo - is name of item image
      • getImagesOfItems

        public java.util.LinkedList<java.awt.image.BufferedImage> getImagesOfItems()
      • getImageFromCellMap

        public int getImageFromCellMap​(java.lang.String cell)
      • getImagesOfTiles

        public java.util.LinkedList<java.awt.image.BufferedImage> getImagesOfTiles()
      • getImageDoor

        public ImageDoor getImageDoor()
      • getMapForeground

        public int[][] getMapForeground()
      • getMapBackground

        public int[][] getMapBackground()
      • setMapBackground

        public void setMapBackground​(int[][] mapBackground)
      • setMapForeground

        public void setMapForeground​(int[][] mapForeground)
      • paintBackground

        public void paintBackground​(java.awt.Graphics g,
                                    int x,
                                    int y)
      • paintForeground

        public void paintForeground​(java.awt.Graphics g,
                                    int x,
                                    int y)