Class Controller

    • Constructor Summary

      Constructors 
      Constructor Description
      Controller​()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose​()
      should be called if removed from memory
      void enter​()
      Should be called when the manager becomes active.
      void executeCommand​(Command cmd)
      Executes the command and saves it for possible undo/redo.
      void exit​()
      Should get called when you leave the editor.
      Cursor getCursor​()
      Get the entity laying under the cursor.
      DevTools getDevTools​()  
      static LightEngine getLightEngine​()
      The light engine doing the lighting.
      static Map getMap​()
      Returns the currently loaded map.
      int getSaveSlot​()
      Get the save slot used for loading and saving the map.
      java.util.ArrayList<AbstractEntity> getSelectedEntities​()  
      void init​()
      This method works like a constructor.
      void init​(java.lang.String mapName, int saveslot)
      This method works like a constructor.
      boolean isInitalized​()  
      static boolean loadMap​(java.io.File path, int saveslot)
      Tries loading a new map instance.
      int newSaveSlot​()
      Uses a new save slot as the save slot
      void onEnter​()
      Override to specify what should happen when the mangager becomes active.
      void redoCommand​()  
      boolean save​()
      saves the map and the complete game state
      static void setLightEngine​(LightEngine le)  
      static void setMap​(Map map)  
      void setMapName​(java.lang.String mapName)
      Set the map name which is loaded then.
      void setSelectedEnt​(java.util.ArrayList<AbstractEntity> newSel)
      filter map editor entities
      void showCursor​()  
      static void staticDispose​()
      Disposes static stuff.
      static void staticUpdate​(float dt)
      update every static update method
      void undoCommand​()  
      void update​(float dt)
      Main method which is called every refresh.
      void useSaveSlot​(int slot)
      Uses a specific save slot for loading and saving the map.
      • Methods inherited from class java.lang.Object

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

      • Controller

        public Controller​()
    • Method Detail

      • staticUpdate

        public static void staticUpdate​(float dt)
        update every static update method
        Parameters:
        dt -
      • loadMap

        public static boolean loadMap​(java.io.File path,
                                      int saveslot)
        Tries loading a new map instance.
        Parameters:
        path -
        saveslot - this saveslot will become the active
        Returns:
        returns true if the map could be loaded and false if it failed
      • getMap

        public static Map getMap​()
        Returns the currently loaded map.
        Returns:
        the map
      • setMap

        public static void setMap​(Map map)
        Parameters:
        map -
      • getLightEngine

        public static LightEngine getLightEngine​()
        The light engine doing the lighting.
        Returns:
        can return null
      • setLightEngine

        public static void setLightEngine​(LightEngine le)
        Parameters:
        le -
      • staticDispose

        public static void staticDispose​()
        Disposes static stuff.
      • executeCommand

        public void executeCommand​(Command cmd)
        Executes the command and saves it for possible undo/redo.
        Parameters:
        cmd -
      • undoCommand

        public void undoCommand​()
      • redoCommand

        public void redoCommand​()
      • useSaveSlot

        public void useSaveSlot​(int slot)
        Uses a specific save slot for loading and saving the map. Can be called before calling init().
        Parameters:
        slot -
      • setMapName

        public void setMapName​(java.lang.String mapName)
        Set the map name which is loaded then. Should be called before the init()
        Parameters:
        mapName - the name of the map on the file system
      • getSaveSlot

        public int getSaveSlot​()
        Get the save slot used for loading and saving the map.
        Returns:
        save slot number
      • newSaveSlot

        public int newSaveSlot​()
        Uses a new save slot as the save slot
        Returns:
        the new save slot number
      • init

        public void init​()
        This method works like a constructor. Everything is loaded here. You must set your custom map generator, if you want one, before calling this method, because chunk loading is started by calling this method. Uses last set saveslot and mapName. Set before calling this.
        See Also:
        init(java.lang.String, int)
      • update

        public void update​(float dt)
        Main method which is called every refresh.
        Parameters:
        dt - time since last call
      • showCursor

        public void showCursor​()
      • getDevTools

        public DevTools getDevTools​()
        Returns:
      • onEnter

        public void onEnter​()
        Description copied from interface: GameManager
        Override to specify what should happen when the mangager becomes active. Super call must not be implemented.
        Specified by:
        onEnter in interface GameManager
      • exit

        public void exit​()
        Description copied from interface: GameManager
        Should get called when you leave the editor. To extend this method you should overwrite adn call super ethod.
        Specified by:
        exit in interface GameManager
      • save

        public boolean save​()
        saves the map and the complete game state
        Returns:
      • dispose

        public void dispose​()
        Description copied from interface: GameManager
        should be called if removed from memory
        Specified by:
        dispose in interface GameManager
      • getSelectedEntities

        public java.util.ArrayList<AbstractEntity> getSelectedEntities​()
        Returns:
        selected entities but map editor entities
      • setSelectedEnt

        public void setSelectedEnt​(java.util.ArrayList<AbstractEntity> newSel)
        filter map editor entities
        Parameters:
        newSel -
      • getCursor

        public Cursor getCursor​()
        Get the entity laying under the cursor.
        Returns: