//---------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright (C)2007 DarkWynter Studios. All rights reserved.
//
//---------------------------------------------------------------------------------------------------------------------------------------------------
// {Contact : darkwynter.com for licensing information
//---------------------------------------------------------------------------------------------------------------------------------------------------
namespace DarkWynter.Engine.Controllers
{
#region Using Statements
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using System.Diagnostics;
//using DarkWynter.Engine.ObjectLib;
//using DarkWynter.Engine.Menus;
using Controllers;
#endregion
///
/// Keyboard event class for mapping a keyboard button to an event
///
public class KeyboardControl
{
// Time delay between key presses to avoid double input
private int KEY_TIMER_MAX_MILLI = 10;
private Stopwatch controlTimer = new Stopwatch();
///
/// Keyboard key we are checking for
///
public Keys key = Keys.None;
///
/// On click delegate type
///
/// Controller boolean event arguments
public delegate void OnClickHandler(ControllerBoolEventArgs args);
private event OnClickHandler click;
///
/// Constructor
///
/// Keyboard key to watch
/// Delegate to be invoked
/// Time delay between multiple invocations
public KeyboardControl(Keys keyboardkey, OnClickHandler onClickHandler, int timerValue)
{
key = keyboardkey; // Assign Key
click += new OnClickHandler(onClickHandler); // Assign delegate
controlTimer.Start(); // Start timer
KEY_TIMER_MAX_MILLI = timerValue; // Assign time delay
}
///
/// Update Method
///
/// Updated keyboard state
/// Object Library
/// Menu System
public void Update(KeyboardState keyboardState, ref List