00001 #region License
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #endregion
00027
00028 using System;
00029 using System.Collections.Generic;
00030 using System.Text;
00031
00032 namespace OpenTK.Platform.Windows
00033 {
00034 using Graphics;
00035 using OpenTK.Input;
00036
00037 class WinFactory : IPlatformFactory
00038 {
00039 #region IPlatformFactory Members
00040
00041 public virtual INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
00042 {
00043 return new WinGLNative(x, y, width, height, title, options, device);
00044 }
00045
00046 public virtual IDisplayDeviceDriver CreateDisplayDeviceDriver()
00047 {
00048 return new WinDisplayDeviceDriver();
00049 }
00050
00051 public virtual IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
00052 {
00053 return new WinGLContext(mode, (WinWindowInfo)window, shareContext, major, minor, flags);
00054 }
00055
00056 public virtual IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
00057 {
00058 return new WinGLContext(handle, (WinWindowInfo)window, shareContext, major, minor, flags);
00059 }
00060
00061 public virtual GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
00062 {
00063 return (GraphicsContext.GetCurrentContextDelegate)delegate
00064 {
00065 return new ContextHandle(Wgl.GetCurrentContext());
00066 };
00067 }
00068
00069 public virtual IGraphicsMode CreateGraphicsMode()
00070 {
00071 return new WinGraphicsMode();
00072 }
00073
00074 public virtual OpenTK.Input.IKeyboardDriver CreateKeyboardDriver()
00075 {
00076 throw new NotImplementedException();
00077
00078 if (System.Environment.OSVersion.Version.Major >= 5)
00079 return new WinRawKeyboard();
00080 else
00081 return new WMInput(null);
00082 }
00083
00084 #endregion
00085 }
00086 }