cpw.mods.fml.client.registry
Class KeyBindingRegistry.KeyHandler

java.lang.Object
  extended by cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler
All Implemented Interfaces:
ITickHandler
Direct Known Subclasses:
ModLoaderKeyBindingHandler
Enclosing class:
KeyBindingRegistry

public abstract static class KeyBindingRegistry.KeyHandler
extends Object
implements ITickHandler

Extend this class to register a KeyBinding and recieve callback when the key binding is triggered

Author:
cpw

Constructor Summary
KeyBindingRegistry.KeyHandler(KeyBinding[] keyBindings)
          Register the keys into the system.
KeyBindingRegistry.KeyHandler(KeyBinding[] keyBindings, boolean[] repeatings)
          Pass an array of keybindings and a repeat flag for each one
 
Method Summary
 KeyBinding[] getKeyBindings()
           
abstract  void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat)
          Called when the key is first in the down position on any tick from the ticks() set.
abstract  void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd)
          Fired once when the key changes state from down to up
 void tickEnd(EnumSet<TickType> type, Object... tickData)
          Not to be overridden - KeyBindings are tickhandlers under the covers
abstract  EnumSet<TickType> ticks()
          This is the list of ticks for which the key binding should trigger.
 void tickStart(EnumSet<TickType> type, Object... tickData)
          Not to be overridden - KeyBindings are tickhandlers under the covers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cpw.mods.fml.common.ITickHandler
getLabel
 

Constructor Detail

KeyBindingRegistry.KeyHandler

public KeyBindingRegistry.KeyHandler(KeyBinding[] keyBindings,
                                     boolean[] repeatings)
Pass an array of keybindings and a repeat flag for each one

Parameters:
keyBindings -
repeatings -

KeyBindingRegistry.KeyHandler

public KeyBindingRegistry.KeyHandler(KeyBinding[] keyBindings)
Register the keys into the system. You will do your own keyboard management elsewhere. No events will fire if you use this method

Parameters:
keyBindings -
Method Detail

getKeyBindings

public KeyBinding[] getKeyBindings()

tickStart

public final void tickStart(EnumSet<TickType> type,
                            Object... tickData)
Not to be overridden - KeyBindings are tickhandlers under the covers

Specified by:
tickStart in interface ITickHandler

tickEnd

public final void tickEnd(EnumSet<TickType> type,
                          Object... tickData)
Not to be overridden - KeyBindings are tickhandlers under the covers

Specified by:
tickEnd in interface ITickHandler

keyDown

public abstract void keyDown(EnumSet<TickType> types,
                             KeyBinding kb,
                             boolean tickEnd,
                             boolean isRepeat)
Called when the key is first in the down position on any tick from the ticks() set. Will be called subsequently with isRepeat set to true

Parameters:
types - the type(s) of tick that fired when this key was first down
tickEnd - was it an end or start tick which fired the key
isRepeat - is it a repeat key event
See Also:
keyUp(EnumSet, KeyBinding, boolean)

keyUp

public abstract void keyUp(EnumSet<TickType> types,
                           KeyBinding kb,
                           boolean tickEnd)
Fired once when the key changes state from down to up

Parameters:
types - the type(s) of tick that fired when this key was first down
tickEnd - was it an end or start tick which fired the key
See Also:
keyDown(EnumSet, KeyBinding, boolean, boolean)

ticks

public abstract EnumSet<TickType> ticks()
This is the list of ticks for which the key binding should trigger. The only valid ticks are client side ticks, obviously.

Specified by:
ticks in interface ITickHandler
See Also:
ITickHandler.ticks()