InputDriver now checks for pre-XP windows versions, and instantiates the WMInput driver.

This commit is contained in:
the_fiddler 2007-10-19 20:01:41 +00:00
parent 32d40b8033
commit 085ae52ce4

View file

@ -24,22 +24,32 @@ namespace OpenTK
if (parent == null) if (parent == null)
throw new ArgumentException("A valid window (IWindowInfo) must be specified to construct an InputDriver"); throw new ArgumentException("A valid window (IWindowInfo) must be specified to construct an InputDriver");
if (Environment.OSVersion.Version.Major > 5 || switch (Environment.OSVersion.Platform)
(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1))
{ {
inputDriver = new OpenTK.Platform.Windows.WinRawInput(parent.WindowInfo); case PlatformID.Win32Windows:
} case PlatformID.Win32NT:
else if (Environment.OSVersion.Platform == PlatformID.Unix) case PlatformID.Win32S:
{ case PlatformID.WinCE:
//inputDriver = new OpenTK.Platform.X11.X11Input( if (Environment.OSVersion.Version.Major > 5 ||
// parent is OpenTK.Platform.X11.WindowInfo ? (OpenTK.Platform.X11.WindowInfo)parent : (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1))
// parent is OpenTK.Platform.WindowInfo ? (OpenTK.Platform.X11.WindowInfo)(parent as OpenTK.Platform.WindowInfo) : null); {
inputDriver = new OpenTK.Platform.X11.X11Input(parent.WindowInfo); inputDriver = new OpenTK.Platform.Windows.WinRawInput(parent.WindowInfo);
} }
else else
{ {
throw new PlatformNotSupportedException( // Legacy or unknown windows version:
"Input handling is not supported on the current platform. Please report the problem to http://opentk.sourceforge.net"); inputDriver = new OpenTK.Platform.Windows.WMInput(parent.WindowInfo);
}
break;
case PlatformID.Unix:
inputDriver = new OpenTK.Platform.X11.X11Input(parent.WindowInfo);
break;
default:
throw new PlatformNotSupportedException(
"Input handling is not supported on the current platform. Please report the problem to http://opentk.sourceforge.net");
} }
} }