Game Development Reference
In-Depth Information
public delegate void ActionDelegate();
public event ActionDelegate KeyboardAction;
private KeyboardState _keyboardState;
public bool Initialize(System.Windows.Forms.Form context)
_context = context;
_threadData = new Thread(new ThreadStart(this.AsynchronousPolling));
_eventTrigger = new AutoResetEvent(false);
_device = new Device(SystemGuid.Keyboard);
catch (InputException)
return false;
CooperativeLevelFlags.NonExclusive |
return true;
The following method is used to query the keyboard state to determine whether a
particular key is depressed. The keyboard state is cached each time the state
changes within the asynchronous polling thread.
public bool KeyDown(Key key)
if (_keyboardState != null && _keyboardState[key])
Search Nedrilad ::

Custom Search