Package net.regsirius06.engine.control
Class KeyLogic
java.lang.Object
net.regsirius06.engine.control.KeyLogic
Deprecated.
This class is deprecated. Consider using an alternative event handling system.
Handles the logic for interpreting key inputs and performing actions based on key bindings.
This class is responsible for analyzing key events related to player movement and interaction with the labyrinth.
It processes key presses to move the player, rotate the player, and toggle the minimap display.
The class uses a KeyDefinition instance to map actions to specific key codes and interprets key events accordingly.
-
Constructor Summary
ConstructorsConstructorDescriptionKeyLogic(KeyDefinition definition) Deprecated.Constructs a newKeyLogicinstance with the given key definition. -
Method Summary
Modifier and TypeMethodDescription@Nullable BooleankeyMapAnalysis(@NotNull KeyEvent e, boolean currentState) Deprecated.Analyzes a key press event to toggle the minimap display.voidkeyMoveAnalysis(@NotNull KeyEvent e, Player player, Labyrinth2D labyrinth) Deprecated.Analyzes a key press event and processes the corresponding movement or rotation of the player.
-
Constructor Details
-
KeyLogic
Deprecated.Constructs a newKeyLogicinstance with the given key definition. This constructor initializes the key logic with a set of key bindings that will be used to handle player movements and other actions.- Parameters:
definition- theKeyDefinitioncontaining the key bindings for various actions, such as movement and minimap toggle
-
-
Method Details
-
keyMoveAnalysis
Deprecated.Analyzes a key press event and processes the corresponding movement or rotation of the player. Based on the key event, this method modifies the player's position and orientation within the labyrinth.If the key press corresponds to a movement action, the player's position is updated accordingly. If the key press corresponds to a rotation action, the player's orientation is updated. The method also ensures that the player does not move through walls by checking for collisions within the labyrinth.
- Parameters:
e- theKeyEventrepresenting the key press eventplayer- thePlayerobject whose position and direction are updatedlabyrinth- theLabyrinth2Dobject used to check for collisions with walls
-
keyMapAnalysis
@Nullable public @Nullable Boolean keyMapAnalysis(@NotNull @NotNull KeyEvent e, boolean currentState) Deprecated.Analyzes a key press event to toggle the minimap display. This method checks if the key press corresponds to the minimap toggle action and returns the updated state. The minimap state is toggled from visible to hidden or vice versa based on the key press.- Parameters:
e- theKeyEventrepresenting the key press eventcurrentState- the current state of the minimap (true for visible, false for hidden)- Returns:
- the new state of the minimap (true if it should be shown, false if hidden),
or
nullif the key press does not correspond to the minimap toggle
-