Package mazealgo.view

Class MazeViewController

java.lang.Object
mazealgo.view.MazeViewController

public class MazeViewController extends Object
Controller for MazeView.fxml. Owns the MazeViewModel and wires it to the FXML-injected nodes.

Input handling lives here:

  • 2D/3D toggle → switches displayers, shows/hides the Depth + Focus controls
  • WASD or arrow keys → movePlayer in the four cardinal directions (2D only)
  • Scroll wheel anywhere on the canvas → zoom in/out
  • Primary-button drag on the canvas → pan in 2D / rotate the cube in 3D; right-click recenters
  • Focus combo (3D only) → isolate one layer; the rest are hidden
  • Generate → new 2D maze, or new 3D maze when in 3D mode
  • Algorithm ComboBox → BFS / DFS / Best-First; affects both Hint and Watch
  • Solution Hint → solves and draws the path
  • Watch Search → animates the chosen algorithm visiting cells

The controller listens to the ViewModel's victoryProperty and triggers the chime — keeping the ViewModel free of UI / audio dependencies.

  • Constructor Details

    • MazeViewController

      public MazeViewController()
      Default ctor — used when FXMLLoader has no controller factory. In-process model.
    • MazeViewController

      public MazeViewController(MazeModel model)
      Used by MazeApp via FXMLLoader.setControllerFactory to inject the server-wired model so Generate / Solution Hint go over sockets.