From 8821602728a7fe246878c5a931a0c40931dd22a9 Mon Sep 17 00:00:00 2001 From: Luca Puderbach Date: Wed, 4 Dec 2024 16:44:26 +0100 Subject: [PATCH] kamera --- .../client/gui/CameraInputHandler.java | 119 +++++++++--------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraInputHandler.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraInputHandler.java index bbfeca2..d494b76 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraInputHandler.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/CameraInputHandler.java @@ -1,59 +1,60 @@ -package pp.monopoly.client.gui; - -import com.jme3.input.InputManager; -import com.jme3.input.KeyInput; -import com.jme3.input.controls.ActionListener; -import com.jme3.input.controls.KeyTrigger; - -/** - * Handhabt die Eingaben für die Kamera. - */ -public class CameraInputHandler { - - private CameraController cameraController; // Kamera-Controller - - /** - * Konstruktor für den CameraInputHandler. - * - * @param cameraController Der Kamera-Controller, der gesteuert werden soll. - * @param inputManager Der InputManager, um Eingaben zu registrieren. - */ - public CameraInputHandler(CameraController cameraController, InputManager inputManager) { - if (cameraController == null || inputManager == null) { - throw new IllegalArgumentException("CameraController und InputManager dürfen nicht null sein"); - } - this.cameraController = cameraController; - - // Mappings für Kamerasteuerung - inputManager.addMapping("FocusCurrentPlayer", new KeyTrigger(KeyInput.KEY_1)); // Modus 1 - inputManager.addMapping("FocusSelf", new KeyTrigger(KeyInput.KEY_2)); // Modus 2 - inputManager.addMapping("FreeCam", new KeyTrigger(KeyInput.KEY_3)); // Modus 3 - - // Listener für die Kameramodi - inputManager.addListener(actionListener, "FocusCurrentPlayer", "FocusSelf", "FreeCam"); - } - - /** - * ActionListener für die Kamerasteuerung. - */ - private final ActionListener actionListener = (name, isPressed, tpf) -> { - if (!isPressed) return; - - // Umschalten der Kamera-Modi basierend auf der Eingabe - switch (name) { - case "FocusCurrentPlayer" -> { - cameraController.setMode(CameraController.CameraMode.FOCUS_CURRENT_PLAYER); - System.out.println("Kameramodus: Fokus auf aktuellen Spieler"); - } - case "FocusSelf" -> { - cameraController.setMode(CameraController.CameraMode.FOCUS_SELF); - System.out.println("Kameramodus: Fokus auf eigene Figur"); - } - case "FreeCam" -> { - cameraController.setMode(CameraController.CameraMode.FREECAM); - System.out.println("Kameramodus: Freie Kamera"); - } - default -> System.err.println("Unbekannter Kameramodus: " + name); - } - }; -} +//package pp.monopoly.client.gui; +// +//import com.jme3.input.InputManager; +//import com.jme3.input.KeyInput; +//import com.jme3.input.controls.ActionListener; +//import com.jme3.input.controls.KeyTrigger; +// +///** +// * Handhabt die Eingaben für die Kamera. +// */ +//public class CameraInputHandler { +// +// private CameraController cameraController; // Kamera-Controller +// +// /** +// * Konstruktor für den CameraInputHandler. +// * +// * @param cameraController Der Kamera-Controller, der gesteuert werden soll. +// * @param inputManager Der InputManager, um Eingaben zu registrieren. +// */ +// public CameraInputHandler(CameraController cameraController, InputManager inputManager) { +// if (cameraController == null || inputManager == null) { +// throw new IllegalArgumentException("CameraController und InputManager dürfen nicht null sein"); +// } +// this.cameraController = cameraController; +// +// // Mappings für Kamerasteuerung +// inputManager.addMapping("FocusCurrentPlayer", new KeyTrigger(KeyInput.KEY_1)); // Modus 1 +// inputManager.addMapping("FocusSelf", new KeyTrigger(KeyInput.KEY_2)); // Modus 2 +// inputManager.addMapping("FreeCam", new KeyTrigger(KeyInput.KEY_3)); // Modus 3 +// +// // Listener für die Kameramodi +// inputManager.addListener(actionListener, "FocusCurrentPlayer", "FocusSelf", "FreeCam"); +// } +// +// /** +// * ActionListener für die Kamerasteuerung. +// */ +// private final ActionListener actionListener = (name, isPressed, tpf) -> { +// if (!isPressed) return; +// +// // Umschalten der Kamera-Modi basierend auf der Eingabe +// switch (name) { +// case "FocusCurrentPlayer" -> { +// cameraController.setMode(CameraController.CameraMode.FOCUS_CURRENT_PLAYER); +// System.out.println("Kameramodus: Fokus auf aktuellen Spieler"); +// } +// case "FocusSelf" -> { +// cameraController.setMode(CameraController.CameraMode.FOCUS_SELF); +// System.out.println("Kameramodus: Fokus auf eigene Figur"); +// } +// case "FreeCam" -> { +// cameraController.setMode(CameraController.CameraMode.FREECAM); +// System.out.println("Kameramodus: Freie Kamera"); +// } +// default -> System.err.println("Unbekannter Kameramodus: " + name); +// } +// }; +//} +// \ No newline at end of file