Game Development Reference
In-Depth Information
if (disposing)
if (_eventTrigger != null)
if (_device != null)
_device = null;
_eventTrigger = null;
Asynchronous Keyboard Polling
Just as with the mouse class, you need to include and reference the appropriate
namespaces. You should add a reference to Microsoft.DirectX and
Microsoft.DirectX.DirectInput and use the following namespaces.
using System;
using System.Threading;
using Microsoft.DirectX;
using Microsoft.DirectX.DirectInput;
The following class encapsulates all the nitty gritty details of using DirectInput for
mouse polling. The code is almost identical to the AsynchronousMouse class, so only
the new sections will be discussed.
public class AsynchronousKeyboard : IDisposable
private Device _device = null;
private Thread _threadData = null;
private AutoResetEvent _eventTrigger = null;
private System.Windows.Forms.Form _context;
private bool _acquired = false;
Search Nedrilad ::

Custom Search