Class CanvasController


  • public class CanvasController
    extends java.lang.Object
    • Field Detail

      • canvas

        public javafx.scene.canvas.Canvas canvas
      • canvasPane

        public javafx.scene.layout.Pane canvasPane
    • Constructor Detail

      • CanvasController

        public CanvasController()
    • Method Detail

      • initialize

        public void initialize()
      • makeCanvasResizable

        public void makeCanvasResizable()
      • drawShapes

        public void drawShapes()
      • onCanvasClicked

        public void onCanvasClicked​(javafx.scene.input.MouseEvent mouseEvent)
      • onCanvasDragged

        public void onCanvasDragged​(javafx.scene.input.MouseEvent mouseEvent)
        This will be executed, when the mouse is pressed (and not released) and moves over the canvas

        It will swipe the game to the dragged position.

        Parameters:
        mouseEvent - corresponding MouseEvent
      • onMouseLifted

        public void onMouseLifted​(javafx.scene.input.MouseEvent mouseEvent)
        Handler for when the mouse press event on the canvas ends. We determine that if if we didn't dragged the mouse moving the canvas rendering, we can fire a click selection event.
        Parameters:
        mouseEvent - event of the lifted mouse position
      • onCanvasZoom

        public void onCanvasZoom​(javafx.scene.input.ScrollEvent scrollEvent)
      • setGameManager

        public void setGameManager​(javafx.beans.property.ObjectProperty<GameManager> gameManager)
      • getCanvas

        public javafx.scene.canvas.Canvas getCanvas()