Package snap.games

Class GameController

All Implemented Interfaces:
PropChange.DoChange

public class GameController extends ViewOwner
The controller class for a GameView.
  • Field Details

  • Constructor Details

    • GameController

      public GameController()
      Constructor.
    • GameController

      public GameController(GameView gameView)
      Constructor for given GameView.
  • Method Details

    • getGameView

      public GameView getGameView()
      Returns the GameView.
    • setGameView

      public void setGameView(GameView gameView)
      Sets the GameView.
    • getFrameRate

      public double getFrameRate()
      Returns the frame rate.
    • setFrameRate

      public void setFrameRate(double aValue)
      Sets the frame rate.
    • getFrameDelay

      public int getFrameDelay()
      Returns the frame delay in milliseconds.
    • isAutoPlay

      public boolean isAutoPlay()
      Returns whether game auto-starts.
    • setAutoPlay

      public void setAutoPlay(boolean aValue)
      Sets whether game auto-starts.
    • isPlaying

      public boolean isPlaying()
      Returns whether game is playing.
    • setPlaying

      public void setPlaying(boolean aValue)
      Sets whether game is playing.
    • playGame

      public void playGame()
      Starts the game timer.
    • stopGame

      public void stopGame()
      Stops the game timer.
    • stepGameFrame

      public void stepGameFrame()
      Steps the game forward a frame.
    • resetGameView

      public void resetGameView()
      Reset GameView.
    • handleShowingChange

      protected void handleShowingChange()
      Called when game view has showing change.
    • createUI

      protected View createUI()
      Create UI.
      Overrides:
      createUI in class ViewOwner