|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.command.InputProvider
public class InputProvider
The central provider that maps real device input into abstract commands defined by the developer. Registering a control against an command with this class will cause the provider to produce an event for the command when the input is pressed and released.
Constructor Summary | |
---|---|
InputProvider(Input input)
Create a new input proider which will provide abstract input descriptions based on the input from the supplied context. |
Method Summary | |
---|---|
void |
addListener(InputProviderListener listener)
Add a listener to the provider. |
void |
bindCommand(Control control,
Command command)
Bind an command to a control. |
void |
clearCommand(Command command)
Clear all the controls that have been configured for a given command |
protected void |
firePressed(Command command)
Fire notification to any interested listeners that a control has been pressed indication an particular command |
protected void |
fireReleased(Command command)
Fire notification to any interested listeners that a control has been released indication an particular command should be stopped |
java.util.List |
getControlsFor(Command command)
Get a list of the registered controls (@see Control) that can cause a particular command to be invoked |
java.util.List |
getUniqueCommands()
Get the list of commands that have been registered with the provider, i.e. |
boolean |
isActive()
Check if this provider should be sending events |
boolean |
isCommandControlDown(Command command)
Check if the last control event we recieved related to the given command indicated that a control was down |
boolean |
isCommandControlPressed(Command command)
Check if one of the controls related to the command specified has been pressed since we last called this method |
void |
removeListener(InputProviderListener listener)
Remove a listener from this provider. |
void |
setActive(boolean active)
Indicate whether this provider should be sending events |
void |
unbindCommand(Control control)
Unbinds the command associated with this control |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InputProvider(Input input)
input
- The input from which this provider will receive eventsMethod Detail |
---|
public java.util.List getUniqueCommands()
public java.util.List getControlsFor(Command command)
command
- The command to be invoked
public void setActive(boolean active)
active
- True if this provider should be sending eventspublic boolean isActive()
public void addListener(InputProviderListener listener)
listener
- The listener to be addedpublic void removeListener(InputProviderListener listener)
listener
- The listener to be removedpublic void bindCommand(Control control, Command command)
command
- The command to bind tocontrol
- The control that is pressed/released to represent the commandpublic void clearCommand(Command command)
command
- The command whose controls should be unboundpublic void unbindCommand(Control control)
control
- The control to removepublic boolean isCommandControlDown(Command command)
command
- The command to check
public boolean isCommandControlPressed(Command command)
command
- The command to check
protected void firePressed(Command command)
command
- The command that has been pressedprotected void fireReleased(Command command)
command
- The command that has been pressed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |