Class Canvas

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class Canvas extends JPanel
Provides a canvas painting the various objects within our world. This is not relevant to continue the project.
See Also:
  • Constructor Details

    • Canvas

      public Canvas(World world, int size, boolean startIso)
  • Method Details

    • isIsomorphic

      public boolean isIsomorphic()
      Returns:
      if using isomorphic renderer
    • acquireRenderPermit

      public void acquireRenderPermit()
      Acquire a new render permit (total permits acccording to RENDER_PERMITS)
    • setIsomorphic

      public void setIsomorphic(boolean isomorphic)
      Boolean to control whether to render isomorphic or topdown
      Parameters:
      isomorphic - sets the boolean
    • setDisplayInformation

      public void setDisplayInformation(Class cl, DisplayInformation di)
      Decide on the graphical representation of objects when shown within the GUI.
      Parameters:
      cl - is the class which to associate a given display type with (can be accessed by writing [ClassName].class).
      di - the DisplayInformation to associate the type of object with.
    • paintImage

      public void paintImage()
      Paints the proper image depending on whether we are showing grid or isomorphic view (with a delay of 0)
    • paintImage

      public void paintImage(int delay)
      Paints the proper image depending on whether we are showing grid or isomorphic view.
      Parameters:
      delay -
    • paintComponent

      protected void paintComponent(Graphics g)
      Override of the paintComponent to deplete from the queue of images left to render.
      Overrides:
      paintComponent in class JComponent
    • reduceImgQueue

      public void reduceImgQueue()
      To speed up the process of pausing, you can reduce the amount of remaining frames (according to SLOW_DOWN_FRAMES).