Crossfire JXClient, Trunk
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.realtime.crossfire.jxclient.window.KeyHandler Class Reference
Collaboration diagram for com.realtime.crossfire.jxclient.window.KeyHandler:
Collaboration graph

Public Member Functions

boolean isRunningUsingCtrl ()
 
 KeyHandler (@Nullable final Writer debugKeyboard, @NotNull final KeybindingsManager keybindingsManager, @NotNull final CommandQueue commandQueue, @NotNull final JXCWindowRenderer windowRenderer, @NotNull final KeyHandlerListener keyHandlerListener)
 
void keyPressed (@NotNull final KeyEvent e)
 
void keyReleased (@NotNull final KeyEvent e)
 
void setDefaultKeyBindings (@NotNull final KeyBindings defaultKeyBindings)
 

Private Member Functions

void debugKeyboardWrite (@NotNull final CharSequence message)
 
void debugKeyboardWrite (@NotNull final String type, @NotNull final KeyEvent keyEvent, @NotNull final KeyEvent2 keyEvent2)
 
void handleKeyPress (@NotNull final KeyEvent2 e)
 
void handleKeyRelease (@NotNull final KeyEvent2 e)
 
void updateModifiers (@NotNull final KeyEvent2 keyEvent)
 

Private Attributes

final CommandQueue commandQueue
 
final Writer debugKeyboard
 
boolean isRunningUsingCtrl
 
final KeybindingsManager keybindingsManager
 
final KeyHandlerListener keyHandlerListener
 
final JXCWindowRenderer windowRenderer
 

Static Private Attributes

static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss,SSS ", Locale.ENGLISH)
 

Detailed Description

Handles keyboard input processing.

Author
Lauwenmark
Andreas Kirschbaum

Definition at line 45 of file KeyHandler.java.

Constructor & Destructor Documentation

◆ KeyHandler()

com.realtime.crossfire.jxclient.window.KeyHandler.KeyHandler ( @Nullable final Writer  debugKeyboard,
@NotNull final KeybindingsManager  keybindingsManager,
@NotNull final CommandQueue  commandQueue,
@NotNull final JXCWindowRenderer  windowRenderer,
@NotNull final KeyHandlerListener  keyHandlerListener 
)

Creates a new instance.

Parameters
debugKeyboardthe writer for logging keyboard debug output; may
keybindingsManagerthe keybindings manager to use
commandQueuethe command queue to use
windowRendererthe window renderer to use
keyHandlerListenerthe key handler listener to notify

Definition at line 97 of file KeyHandler.java.

References com.realtime.crossfire.jxclient.window.KeyHandler.commandQueue, com.realtime.crossfire.jxclient.window.KeyHandler.debugKeyboard, com.realtime.crossfire.jxclient.window.KeyHandler.keybindingsManager, com.realtime.crossfire.jxclient.window.KeyHandler.keyHandlerListener, and com.realtime.crossfire.jxclient.window.KeyHandler.windowRenderer.

Member Function Documentation

◆ debugKeyboardWrite() [1/2]

void com.realtime.crossfire.jxclient.window.KeyHandler.debugKeyboardWrite ( @NotNull final CharSequence  message)
private

Writes a message to the keyboard debug.

Parameters
messagethe message to write

Definition at line 316 of file KeyHandler.java.

References com.realtime.crossfire.jxclient.window.KeyHandler.debugKeyboard, and com.realtime.crossfire.jxclient.window.KeyHandler.FORMATTER.

◆ debugKeyboardWrite() [2/2]

void com.realtime.crossfire.jxclient.window.KeyHandler.debugKeyboardWrite ( @NotNull final String  type,
@NotNull final KeyEvent  keyEvent,
@NotNull final KeyEvent2  keyEvent2 
)
private

◆ handleKeyPress()

void com.realtime.crossfire.jxclient.window.KeyHandler.handleKeyPress ( @NotNull final KeyEvent2  e)
private

◆ handleKeyRelease()

void com.realtime.crossfire.jxclient.window.KeyHandler.handleKeyRelease ( @NotNull final KeyEvent2  e)
private

◆ isRunningUsingCtrl()

boolean com.realtime.crossfire.jxclient.window.KeyHandler.isRunningUsingCtrl ( )

Returns whether the player is running because of the Ctrl key or not.

Returns
true if the Ctrl key is pressed, false else.

Definition at line 337 of file KeyHandler.java.

References com.realtime.crossfire.jxclient.window.KeyHandler.isRunningUsingCtrl.

◆ keyPressed()

void com.realtime.crossfire.jxclient.window.KeyHandler.keyPressed ( @NotNull final KeyEvent  e)

Handles a "key pressed" event.

Parameters
ethe key event to handle

Definition at line 260 of file KeyHandler.java.

References com.realtime.crossfire.jxclient.window.KeyHandler.debugKeyboardWrite(), and com.realtime.crossfire.jxclient.window.KeyHandler.handleKeyPress().

Here is the call graph for this function:

◆ keyReleased()

void com.realtime.crossfire.jxclient.window.KeyHandler.keyReleased ( @NotNull final KeyEvent  e)

Handles a "key released" event.

Parameters
ethe key event to handle

Definition at line 274 of file KeyHandler.java.

References com.realtime.crossfire.jxclient.window.KeyHandler.debugKeyboardWrite(), and com.realtime.crossfire.jxclient.window.KeyHandler.handleKeyRelease().

Here is the call graph for this function:

◆ setDefaultKeyBindings()

void com.realtime.crossfire.jxclient.window.KeyHandler.setDefaultKeyBindings ( @NotNull final KeyBindings  defaultKeyBindings)

Sets the default KeyBindings of the currently active skin.

Parameters
defaultKeyBindingsthe default key bindings

Definition at line 109 of file KeyHandler.java.

References com.realtime.crossfire.jxclient.window.KeyHandler.keybindingsManager, and com.realtime.crossfire.jxclient.gui.keybindings.KeybindingsManager.setDefaultKeyBindings().

Referenced by com.realtime.crossfire.jxclient.main.JXCWindow.JXCWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateModifiers()

void com.realtime.crossfire.jxclient.window.KeyHandler.updateModifiers ( @NotNull final KeyEvent2  keyEvent)
private

Member Data Documentation

◆ commandQueue

final CommandQueue com.realtime.crossfire.jxclient.window.KeyHandler.commandQueue
private

◆ debugKeyboard

final Writer com.realtime.crossfire.jxclient.window.KeyHandler.debugKeyboard
private

The Writer for logging keyboard debug output. Log nothing if

null

.

Definition at line 52 of file KeyHandler.java.

Referenced by com.realtime.crossfire.jxclient.window.KeyHandler.debugKeyboardWrite(), and com.realtime.crossfire.jxclient.window.KeyHandler.KeyHandler().

◆ FORMATTER

final DateTimeFormatter com.realtime.crossfire.jxclient.window.KeyHandler.FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss,SSS ", Locale.ENGLISH)
staticprivate

A formatter for timestamps.

Definition at line 82 of file KeyHandler.java.

Referenced by com.realtime.crossfire.jxclient.window.KeyHandler.debugKeyboardWrite().

◆ isRunningUsingCtrl

boolean com.realtime.crossfire.jxclient.window.KeyHandler.isRunningUsingCtrl
private

Whether the player is running because she is using the Ctrl key or not.

Definition at line 87 of file KeyHandler.java.

Referenced by com.realtime.crossfire.jxclient.window.KeyHandler.isRunningUsingCtrl(), and com.realtime.crossfire.jxclient.window.KeyHandler.updateModifiers().

◆ keybindingsManager

final KeybindingsManager com.realtime.crossfire.jxclient.window.KeyHandler.keybindingsManager
private

◆ keyHandlerListener

final KeyHandlerListener com.realtime.crossfire.jxclient.window.KeyHandler.keyHandlerListener
private

◆ windowRenderer

final JXCWindowRenderer com.realtime.crossfire.jxclient.window.KeyHandler.windowRenderer
private

The documentation for this class was generated from the following file: