Removed WinForms dependency and performed general code cleanup.

This commit is contained in:
the_fiddler 2010-11-08 19:48:01 +00:00
parent 3a967fcfb7
commit 3a57aa777a

View file

@ -1,26 +1,42 @@
#region --- License --- #region License
/* Copyright (c) 2007 Stefanos Apostolopoulos //
* See license.txt for license information // The Open Toolkit Library License
*/ //
// Copyright (c) 2006 - 2010 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using OpenTK.Platform.Windows;
using OpenTK.Input; using OpenTK.Input;
using System.Diagnostics;
namespace OpenTK.Platform.Windows namespace OpenTK.Platform.Windows
{ {
internal class WinKeyMap : Dictionary<VirtualKeys, Input.Key> class WinKeyMap : Dictionary<VirtualKeys, Input.Key>
{ {
/// <summary> /// <summary>
/// Initializes the map between VirtualKeys and OpenTK.Key /// Initializes the map between VirtualKeys and OpenTK.Key
/// </summary> /// </summary>
internal WinKeyMap() public WinKeyMap()
{
try
{ {
this.Add(VirtualKeys.ESCAPE, Key.Escape); this.Add(VirtualKeys.ESCAPE, Key.Escape);
@ -102,12 +118,5 @@ namespace OpenTK.Platform.Windows
this.Add(VirtualKeys.LEFT, Key.Left); this.Add(VirtualKeys.LEFT, Key.Left);
this.Add(VirtualKeys.RIGHT, Key.Right); this.Add(VirtualKeys.RIGHT, Key.Right);
} }
catch (ArgumentException e)
{
Debug.Print("Exception while creating keymap: '{0}'.", e.ToString());
System.Windows.Forms.MessageBox.Show(
String.Format("Exception while creating keymap: '{0}'.", e.ToString()));
}
}
} }
} }