public final class KeyboardSwt extends Object implements Keyboard, org.eclipse.swt.events.KeyListener
Constructor and Description |
---|
KeyboardSwt()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addActionPressed(Integer key,
EventAction action)
Add an action that will be triggered on pressed state.
|
void |
addActionReleased(Integer key,
EventAction action)
Add an action that will be triggered on released state.
|
double |
getHorizontalDirection() |
Integer |
getKeyCode()
Get the current pressed key code.
|
char |
getKeyName()
Get the current pressed key name.
|
double |
getVerticalDirection() |
boolean |
isPressed(Integer key)
Check if the key is currently pressed.
|
boolean |
isPressedOnce(Integer key)
Check if the key is currently pressed (not continuously).
|
void |
keyPressed(org.eclipse.swt.events.KeyEvent event) |
void |
keyReleased(org.eclipse.swt.events.KeyEvent event) |
void |
removeActionsPressed()
Remove all pressed actions.
|
void |
removeActionsReleased()
Remove all released actions.
|
void |
setHorizontalControlNegative(Integer code) |
void |
setHorizontalControlPositive(Integer code) |
void |
setVerticalControlNegative(Integer code) |
void |
setVerticalControlPositive(Integer code) |
boolean |
used()
Check if the keyboard is currently used (at least one pressed key).
|
public void addActionPressed(Integer key, EventAction action)
Keyboard
Alternative usage with classic programming style can be achieved with Keyboard.isPressed(Integer)
or
Keyboard.isPressedOnce(Integer)
.
addActionPressed
in interface Keyboard
key
- The action key.action
- The action reference.public void addActionReleased(Integer key, EventAction action)
Keyboard
Alternative usage with classic programming style can be achieved with Keyboard.isPressed(Integer)
or
Keyboard.isPressedOnce(Integer)
.
addActionReleased
in interface Keyboard
key
- The action key.action
- The action reference.public void removeActionsPressed()
Keyboard
removeActionsPressed
in interface Keyboard
public void removeActionsReleased()
Keyboard
removeActionsReleased
in interface Keyboard
public boolean isPressed(Integer key)
Keyboard
Alternative usage with event programming style can be achieved with
Keyboard.addActionPressed(Integer, EventAction)
and Keyboard.addActionReleased(Integer, EventAction)
.
public boolean isPressedOnce(Integer key)
Keyboard
Alternative usage with event programming style can be achieved with
Keyboard.addActionPressed(Integer, EventAction)
and Keyboard.addActionReleased(Integer, EventAction)
.
isPressedOnce
in interface Keyboard
key
- The key to check.true
if pressed, false
else.public Integer getKeyCode()
Keyboard
getKeyCode
in interface Keyboard
if key never pressed).public char getKeyName()
Keyboard
getKeyName
in interface Keyboard
public boolean used()
Keyboard
public void setHorizontalControlPositive(Integer code)
setHorizontalControlPositive
in interface com.b3dgs.lionengine.core.InputDeviceDirectional
public void setHorizontalControlNegative(Integer code)
setHorizontalControlNegative
in interface com.b3dgs.lionengine.core.InputDeviceDirectional
public void setVerticalControlPositive(Integer code)
setVerticalControlPositive
in interface com.b3dgs.lionengine.core.InputDeviceDirectional
public void setVerticalControlNegative(Integer code)
setVerticalControlNegative
in interface com.b3dgs.lionengine.core.InputDeviceDirectional
public double getHorizontalDirection()
getHorizontalDirection
in interface com.b3dgs.lionengine.core.InputDeviceDirectional
public double getVerticalDirection()
getVerticalDirection
in interface com.b3dgs.lionengine.core.InputDeviceDirectional
public void keyPressed(org.eclipse.swt.events.KeyEvent event)
keyPressed
in interface org.eclipse.swt.events.KeyListener
public void keyReleased(org.eclipse.swt.events.KeyEvent event)
keyReleased
in interface org.eclipse.swt.events.KeyListener
Copyright © 2016 Byron 3D Games Studio. All rights reserved.