Package gui

Class GUI

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class GUI extends JFrame
An instance is a GUI for the game. Run this
file as a Java application to test the project.
See Also:
  • Field Details

    • SCREEN_WIDTH

      public static int SCREEN_WIDTH
      Width and height of the entire screen
    • SCREEN_HEIGHT

      public static int SCREEN_HEIGHT
      Width and height of the entire screen
    • GAME_WIDTH_PROP

      public static final double GAME_WIDTH_PROP
      Width and height of the game portion (proportion of total)
      See Also:
    • GAME_HEIGHT_PROP

      public static final double GAME_HEIGHT_PROP
      Width and height of the game portion (proportion of total)
      See Also:
    • FRAMES_PER_SECOND

      public static int FRAMES_PER_SECOND
      Frame rate of game (fps) and frames a single move takes
    • FRAMES_PER_MOVE

      public static int FRAMES_PER_MOVE
      Frame rate of game (fps) and frames a single move takes
    • mazePanel

      protected MazePanel mazePanel
      The panel for generating and drawing the maze
    • diver

      protected DiverSprite diver
      The panel for updating and drawing the diver
    • options

      protected OptionsPanel options
      The panel for showing stats / displaying options
    • animating

      protected boolean animating
      Whether the GUI is doing an animation
  • Constructor Details

    • GUI

      public GUI(Sewers sewers, int diverRow, int diverCol, long seed, GameState gs)
      Constructor: a new display for sewer system with the diver at
      (diverRow, diverCol) using random number seed seed and overseen by GameState gs.
  • Method Details

    • getMazePanel

      public MazePanel getMazePanel()
      Return the MazePanel associated with this GUI.
    • getOptionsPanel

      public OptionsPanel getOptionsPanel()
      Return the OptionsPanel associated with this GUI.
    • moveTo

      public void moveTo(Node dest)
      Move the diver on the GUI to destination dest, and block until the diver has completed the move. Requires: dest is adjacent to the diver's current location
    • updateBonus

      public void updateBonus(double bonus)
      Update the bonus multiplier as displayed by the GUI by bonus
    • updateCoins

      public void updateCoins(int coins, int score)
      Update the number of coins picked up as displayed on the GUI.
      Parameters:
      coins - the number of coins to be displayed
      score - the player's current score
    • updateStepsToGo

      public void updateStepsToGo(int stepsLeft)
      Update the steps remaining as displayed on the GUI to stepsLeft.
    • updateSewer

      public void updateSewer(Sewers c, int numStepsToGo)
      What is the specification?
    • setLighting

      public void setLighting(boolean light)
      Set the sewer system to be all light or all dark, depending on light.
    • getIcon

      public BufferedImage getIcon(Tile.TileType tileType)
      Return an image representing tile type.
    • getCoinIcon

      public BufferedImage getCoinIcon(Node n)
      Return an icon for the coins on tile n, or null if no coins.
    • selectNode

      public void selectNode(Node n)
      Select node n on the GUI.
      This displays information on that node's panel on the screen.
    • displayError

      public void displayError(String e)
      Display error e to the player.
    • startAnimating

      public void startAnimating()
    • isAnimating

      public boolean isAnimating()
    • finishAnimating

      public void finishAnimating()