• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# GameWindowFlags类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中GameWindowFlags的典型用法代码示例。如果您正苦于以下问题:C# GameWindowFlags类的具体用法?C# GameWindowFlags怎么用?C# GameWindowFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GameWindowFlags类属于命名空间,在下文中一共展示了GameWindowFlags类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GameWindow

 /// <summary>Constructs a new GameWindow with the specified attributes.</summary>
 /// <param name="width">The width of the GameWindow in pixels.</param>
 /// <param name="height">The height of the GameWindow in pixels.</param>
 /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the GameWindow.</param>
 /// <param name="title">The title of the GameWindow.</param>
 /// <param name="options">GameWindow options regarding window appearance and behavior.</param>
 /// <param name="device">The OpenTK.Graphics.DisplayDevice to construct the GameWindow in.</param>
 public GameWindow(int width, int height, GraphicsMode mode, string title, bool nullContext,
     GameWindowFlags options, DisplayDevice device)
     : base(width, height, title, options, mode, device)
 {
     try {
         glContext = nullContext ? new NullContext() :
             Factory.Default.CreateGLContext(mode, WindowInfo);
         glContext.MakeCurrent(WindowInfo);
         glContext.LoadAll();
         VSync = true;
     } catch (Exception e) {
         Debug.Print(e.ToString());
         base.Dispose();
         throw;
     }
 }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:23,代码来源:GameWindow.cs


示例2: Initialize

        static public void Initialize(Size resolution, int msaasamples, string mediapath, GameWindowFlags flags = GameWindowFlags.Default)
        {
            StartTime = DateTime.Now;
            MSAASamples = msaasamples;
            World = new World();
            Media.SearchPath = mediapath;
            Media.LoadFileMap();
            ShadowMaps = new ShadowMapsArrayTexture(512, 512);
            Resolution = resolution;
            SetCurrentThreadCores(1);

            ShaderPool = new ShaderPool();

            var thread = Task.Factory.StartNew(() =>
            {
                SetCurrentThreadCores(2);
                DisplayAdapter = new VEngineWindowAdapter("VEngine App", resolution.Width, resolution.Height, flags);

                GraphicsSettings.UseDeferred = true;
                GraphicsSettings.UseRSM = false;
                GraphicsSettings.UseVDAO = true;
                GraphicsSettings.UseFog = false;
                GraphicsSettings.UseBloom = false;
                GraphicsSettings.UseLightPoints = true;

                DisplayAdapter.CursorVisible = false;

                Invoke(() => Initialized = true);
                DisplayAdapter.Run();
            });
            while(!Initialized)
                ;
        }
开发者ID:whztt07,项目名称:vengine,代码行数:33,代码来源:Game.cs


示例3: Sdl2NativeWindow

        public Sdl2NativeWindow(int x, int y, int width, int height,
            string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (sync)
            {
                var bounds = device.Bounds;
                var flags = TranslateFlags(options);
                flags |= WindowFlags.OPENGL;
                flags |= WindowFlags.HIDDEN;
                if (Toolkit.Options.EnableHighResolution)
                {
                    flags |= WindowFlags.ALLOW_HIGHDPI;
                }

                if ((flags & WindowFlags.FULLSCREEN_DESKTOP) != 0 ||
                    (flags & WindowFlags.FULLSCREEN) != 0)
                    window_state = WindowState.Fullscreen;

                if ((flags & WindowFlags.RESIZABLE) == 0)
                    window_border = WindowBorder.Fixed;

                IntPtr handle;
                lock (SDL.Sync)
                {
                    handle = SDL.CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
                    exists = true;
                }
                ProcessEvents();
                window = new Sdl2WindowInfo(handle, null);
                window_id = SDL.GetWindowID(handle);
                windows.Add(window_id, this);
            }
        }
开发者ID:SnowmanTackler,项目名称:OpenTK,代码行数:33,代码来源:Sdl2NativeWindow.cs


示例4: Sdl2NativeWindow

        public Sdl2NativeWindow(int x, int y, int width, int height,
            string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (sync)
            {
                var bounds = device.Bounds;
                var flags = TranslateFlags(options);
                flags |= WindowFlags.OPENGL;
                flags |= WindowFlags.RESIZABLE;
                flags |= WindowFlags.HIDDEN;
                flags |= WindowFlags.ALLOW_HIGHDPI;

                if ((flags & WindowFlags.FULLSCREEN_DESKTOP) != 0 ||
                    (flags & WindowFlags.FULLSCREEN) != 0)
                    window_state = WindowState.Fullscreen;

                IntPtr handle;
                lock (SDL.Sync)
                {
                    EventFilterDelegate = Marshal.GetFunctionPointerForDelegate(EventFilterDelegate_GCUnsafe);
                    handle = SDL.CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
                    SDL.AddEventWatch(EventFilterDelegate, handle);
                    SDL.PumpEvents();
                }
                window = new Sdl2WindowInfo(handle, null);
                window_id = SDL.GetWindowID(handle);
                windows.Add(window_id, this);
                window_title = title;

                exists = true;
            }
        }
开发者ID:shahid-pk,项目名称:opentk,代码行数:32,代码来源:Sdl2NativeWindow.cs


示例5: Main

 public Main(GraphicsMode mode, string title, GameWindowFlags flags)
     : base((int)Constants.Graphics.ScreenResolution.X, (int)Constants.Graphics.ScreenResolution.Y, mode, title, flags)
 {
     Engines = new List<Engine>();
     Constants.SetupEngines(this);
     Constants.Engines.Input.SetMouseShow(false);
 }
开发者ID:Azzi777,项目名称:Umbra-Voxel-Engine,代码行数:7,代码来源:Main.cs


示例6: SDL2GLNative

        public SDL2GLNative(int x, int y, int width, int height, string title,
            GraphicsMode mode,GameWindowFlags options, DisplayDevice device)
            : this()
        {
            if (width <= 0)
                throw new ArgumentOutOfRangeException("width", "Must be higher than zero.");
            if (height <= 0)
                throw new ArgumentOutOfRangeException("height", "Must be higher than zero.");


            Debug.Indent();

			IntPtr windowId;
			desiredSizeX = width;
			desiredSizeY = height;
			isFullscreen = options.HasFlag(GameWindowFlags.Fullscreen);
			if (isFullscreen)
			{
				FixupFullscreenRes(width,height,out width, out height);
			}
			lock (API.sdl_api_lock) {
				API.Init (API.INIT_VIDEO);
				API.VideoInit("",0);
				// NOTE: Seriously, letting the user set x and y coords is a _bad_ idea. We'll let the WM take care of it.
				windowId = API.CreateWindow(title, 0x1FFF0000, 0x1FFF0000, width, height, API.WindowFlags.OpenGL | ((isFullscreen)?API.WindowFlags.Fullscreen:0));
			}
			window = new SDL2WindowInfo(windowId);

			inputDriver = new SDL2Input(window);
            Debug.Unindent();

        }
开发者ID:sulix,项目名称:opentk-sdl2,代码行数:32,代码来源:SDL2GLNative.cs


示例7: LinuxNativeWindow

        public LinuxNativeWindow(IntPtr display, IntPtr gbm, int fd,
            int x, int y, int width, int height, string title,
            GraphicsMode mode, GameWindowFlags options,
            DisplayDevice display_device)
        {
            Debug.Print("[KMS] Creating window on display {0:x}", display);

            Title = title;

            display_device = display_device ?? DisplayDevice.Default;
            if (display_device == null)
            {
                throw new NotSupportedException("[KMS] Driver does not currently support headless systems");
            }

            window = new LinuxWindowInfo(display, fd, gbm, display_device.Id as LinuxDisplay);

            // Note: we only support fullscreen windows on KMS.
            // We implicitly override the requested width and height
            // by the width and height of the DisplayDevice, if any.
            width = display_device.Width;
            height = display_device.Height;
            bounds = new Rectangle(0, 0, width, height);
            client_size = bounds.Size;

            if (!mode.Index.HasValue)
            {
                mode = new EglGraphicsMode().SelectGraphicsMode(window, mode, 0);
            }
            Debug.Print("[KMS] Selected EGL mode {0}", mode);

            SurfaceFormat format = GetSurfaceFormat(display, mode);
            SurfaceFlags usage = SurfaceFlags.Rendering | SurfaceFlags.Scanout;
            if (!Gbm.IsFormatSupported(gbm, format, usage))
            {
                Debug.Print("[KMS] Failed to find suitable surface format, using XRGB8888");
                format = SurfaceFormat.XRGB8888;
            }

            Debug.Print("[KMS] Creating GBM surface on {0:x} with {1}x{2} {3} [{4}]",
                gbm, width, height, format, usage);
            IntPtr gbm_surface =  Gbm.CreateSurface(gbm,
                    width, height, format, usage);
            if (gbm_surface == IntPtr.Zero)
            {
                throw new NotSupportedException("[KMS] Failed to create GBM surface for rendering");
            }

            window.Handle = gbm_surface;
                Debug.Print("[KMS] Created GBM surface {0:x}", window.Handle);

            window.CreateWindowSurface(mode.Index.Value);
            Debug.Print("[KMS] Created EGL surface {0:x}", window.Surface);

            cursor_default = CreateCursor(gbm, Cursors.Default);
            cursor_empty = CreateCursor(gbm, Cursors.Empty);
            Cursor = MouseCursor.Default;
            exists = true;
        }
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:59,代码来源:LinuxNativeWindow.cs


示例8: GLWindow

 /// <summary>
 /// 
 /// </summary>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="name"></param>
 /// <param name="fullscreen"></param>
 public GLWindow(int width, int height, string name, GameWindowFlags fullscreen)
     : base(width, height, GraphicsMode.Default, name, fullscreen, DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible)
 {
     Renderables = new List<IRenderable>();
     ClearColor = new Color4();
     OnLoadFunction = null;
     OnUpdateFunction = null;
     KeyEvents = new Dictionary<Key, Action>();
     MouseEvents = new Dictionary<MouseInformation, Action>();
 }
开发者ID:sudocoders,项目名称:renderer,代码行数:17,代码来源:GLWindow.cs


示例9: RouteViewer

 //Deliberately specify the default constructor with various overrides
 public RouteViewer(int width, int height, GraphicsMode currentGraphicsMode, string openbve, GameWindowFlags @default): base (width,height,currentGraphicsMode,openbve,@default)
 {
     try
     {
         System.Drawing.Icon ico = new System.Drawing.Icon("data\\icon.ico");
         this.Icon = ico;
     }
     catch
     {
     }
 }
开发者ID:leezer3,项目名称:OpenBVE,代码行数:12,代码来源:Gamewindow.cs


示例10: WinGLNative

        public WinGLNative(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device)
        {
            WindowProcedureDelegate = WindowProcedure;
            // To avoid issues with Ati drivers on Windows 6+ with compositing enabled, the context will not be
            // bound to the top-level window, but rather to a child window docked in the parent.
            window = new WinWindowInfo(
                CreateWindow(x, y, width, height, title, options, device, IntPtr.Zero), null);
            child_window = new WinWindowInfo(
                CreateWindow(0, 0, ClientSize.Width, ClientSize.Height, title, options, device, window.WindowHandle), window);

            exists = true;
        }
开发者ID:umby24,项目名称:ClassicalSharp,代码行数:12,代码来源:WinGLNative.cs


示例11: OpenBVEGame

		//We need to explicitly specify the default constructor
		public OpenBVEGame(int width, int height, GraphicsMode currentGraphicsMode, GameWindowFlags @default): base(width, height, currentGraphicsMode, Interface.GetInterfaceString("program_title"), @default)
		{
			try
			{
				var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
				System.Drawing.Icon ico = new System.Drawing.Icon(OpenBveApi.Path.CombineFile(OpenBveApi.Path.CombineDirectory(assemblyFolder, "Data"), "icon.ico"));
				this.Icon = ico;
			}
			catch
			{
			}
		}
开发者ID:leezer3,项目名称:OpenBVE,代码行数:13,代码来源:GameWindow.cs


示例12: DefaultWindow

        public DefaultWindow(DefaultDevice device, int width, int height, ref SwapChainDescription implicitSwapChainDescription, 
            string title, GameWindowFlags gameWindowFlags, DisplayDevice displayDevice, ref Context glContext)
            : base(width, height, GraphicsMode.Default, title, gameWindowFlags, displayDevice)
        {
            glContext = glContext ?? new Context(Context);
            this.glContext = glContext;

            this.device = device;
            implicitSwapChainDesc = implicitSwapChainDescription;
            swapChainSurfaces = new SwapChainSurfaces(device, width, height, ref implicitSwapChainDescription);

            keyboard = new Keyboard(this);
            mouse = new Mouse(this);
        }
开发者ID:Zulkir,项目名称:Beholder,代码行数:14,代码来源:DefaultWindow.cs


示例13: DesktopViewController

        public DesktopViewController(Type rootClass, int windowWidth, int windowHeight, string windowTitle, 
                                     GameWindowFlags windowFlags, DisplayDevice device, GraphicsContextFlags flags) 
            : base(windowWidth, windowHeight, GraphicsMode.Default, windowTitle, windowFlags, device, -1, -1, flags)
        {
            Console.WriteLine("Sparrow-sharp: Starting");
            _rootClass = rootClass;

            Load += HandleLoad;

            RenderFrame += HandleRenderFrame;

            Mouse.Move += OnMouseMove;
            Mouse.ButtonDown += OnMouseButtonChange;
            Mouse.ButtonUp += OnMouseButtonChange;

            // Run the game at 60 updates per second
            Run(60.0);
        }
开发者ID:fmotagarcia,项目名称:sparrow-sharp,代码行数:18,代码来源:DesktopViewController.cs


示例14: Program

 public Program(int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device,
                   int major, int minor, GraphicsContextFlags flags, IGraphicsContext sharedContext)
     : base(width, height, title, options,
            mode == null ? GraphicsMode.Default : mode,
            device == null ? DisplayDevice.Default : device)
 {
     try
     {
         glContext = new GraphicsContext(mode == null ? GraphicsMode.Default : mode, WindowInfo, major, minor, flags);
         glContext.MakeCurrent(WindowInfo);
         (glContext as IGraphicsContextInternal).LoadAll();
     }
     catch (Exception e)
     {
         Debug.Print(e.ToString());
         base.Dispose();
         throw;
     }
 }
开发者ID:corefan,项目名称:awgraphics,代码行数:19,代码来源:Program.cs


示例15: Sdl2NativeWindow

        public Sdl2NativeWindow(int x, int y, int width, int height,
            string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (sync)
            {
                var bounds = device.Bounds;
                var flags = TranslateFlags(options);
                flags |= SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL;
                flags |= SDL.SDL_WindowFlags.SDL_WINDOW_RESIZABLE;
                flags |= SDL.SDL_WindowFlags.SDL_WINDOW_HIDDEN;

                if ((flags & SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP) != 0 ||
                    (flags & SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN) != 0)
                    window_state = WindowState.Fullscreen;

                IntPtr handle;
                lock (SDL.Sync)
                {
                    handle = SDL.SDL_CreateWindow(title, bounds.Left + x, bounds.Top + y, width, height, flags);
                    SDL.SDL_AddEventWatch(EventFilterDelegate, handle);
                    SDL.SDL_PumpEvents();
                }
                window = new Sdl2WindowInfo(handle, null);
                window_id = SDL.SDL_GetWindowID(handle);
                windows.Add(window_id, this);
                window_title = title;

                keyboard.Description = "Standard keyboard";
                keyboard.NumberOfFunctionKeys = 12;
                keyboard.NumberOfKeys = 101;
                keyboard.NumberOfLeds = 3;

                mouse.Description = "Standard mouse";
                mouse.NumberOfButtons = 3;
                mouse.NumberOfWheels = 1;

                keyboards.Add(keyboard);
                mice.Add(mouse);

                exists = true;
            }
        }
开发者ID:andykorth,项目名称:opentk,代码行数:42,代码来源:Sdl2NativeWindow.cs


示例16: NativeWindow

 /// <summary>Constructs a new NativeWindow with the specified attributes.</summary>
 /// <param name="x">Horizontal screen space coordinate of the NativeWindow's origin.</param>
 /// <param name="y">Vertical screen space coordinate of the NativeWindow's origin.</param>
 /// <param name="width">The width of the NativeWindow in pixels.</param>
 /// <param name="height">The height of the NativeWindow in pixels.</param>
 /// <param name="title">The title of the NativeWindow.</param>
 /// <param name="options">GameWindow options specifying window appearance and behavior.</param>
 /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the NativeWindow.</param>
 /// <param name="device">The OpenTK.Graphics.DisplayDevice to construct the NativeWindow in.</param>
 /// <exception cref="System.ArgumentOutOfRangeException">If width or height is less than 1.</exception>
 /// <exception cref="System.ArgumentNullException">If mode or device is null.</exception>
 public NativeWindow(int x, int y, int width, int height, string title, GameWindowFlags options, OpenTK.Graphics.GraphicsMode mode, DisplayDevice device)
 {
     // TODO: Should a constraint be added for the position?
     if (width < 1)
         throw new ArgumentOutOfRangeException("width", "Must be greater than zero.");
     if (height < 1)
         throw new ArgumentOutOfRangeException("height", "Must be greater than zero.");
     if (mode == null)
         throw new ArgumentNullException("mode");
     if (device == null)
         throw new ArgumentNullException("device");
     this.options = options;
     this.device = device;
     implementation = (INativeWindow2)Factory.Default.CreateNativeWindow(x, y, width, height, title, mode, options, this.device);
     if ((options & GameWindowFlags.Fullscreen) != 0)
     {
         this.device.ChangeResolution(width, height, mode.ColorFormat.BitsPerPixel, 0);
         WindowState = WindowState.Fullscreen;
     }
 }
开发者ID:prepare,项目名称:HTML-Renderer,代码行数:31,代码来源:NativeWindow.cs


示例17: AbsDisplayAdapter

        public AbsDisplayAdapter(string title, int width, int height, GameWindowFlags flags)
            : base(width, height,
                new OpenTK.Graphics.GraphicsMode(new ColorFormat(8, 8, 8, 8), 8, 0, 1), title, flags,
                DisplayDevice.Default, 4, 5,
                GraphicsContextFlags.ForwardCompatible | GraphicsContextFlags.Debug)
        {
            Game.DisplayAdapter = this;
            Game.Resolution = new Size(Width, Height);
            GL.Enable(EnableCap.DepthClamp);
            GL.Enable(EnableCap.DebugOutput);
            GL.Enable(EnableCap.DebugOutputSynchronous);
            GL.Enable(EnableCap.Dither);
            GL.Enable(EnableCap.Multisample);

            GL.Enable(EnableCap.DepthTest);
            GL.DepthFunc(DepthFunction.Lequal);
            GL.Enable(EnableCap.CullFace);
            GL.CullFace(CullFaceMode.Back);
            GL.ClearColor(0, 0, 0, 0);
            GL.ClearDepth(1);

            GL.PatchParameter(PatchParameterInt.PatchVertices, 3);

            GL.Disable(EnableCap.Blend);
            GL.DebugMessageCallback((source, type, id, severity, length, message, userParam) =>
            {
                Console.WriteLine("{0} {1} {2} {3} {4} {5} {6}", source, type, id, severity, length, message, userParam);
            }, (IntPtr)0);

            MouseMove += Mouse_Move;
            KeyPress += VEngineWindowAdapter_KeyPress;
            KeyDown += VEngineWindowAdapter_KeyDown;
            KeyUp += VEngineWindowAdapter_KeyUp;
            MouseDown += VEngineWindowAdapter_MouseDown;
            MouseUp += VEngineWindowAdapter_MouseUp;
            MouseWheel += VEngineWindowAdapter_MouseWheel;
            Load += VEngineWindowAdapter_Load;
            Task.Factory.StartNew(() => PhysicsThread());
        }
开发者ID:whztt07,项目名称:vengine,代码行数:39,代码来源:AbsDisplayAdapter.cs


示例18: GameWindow

 /// <summary>Constructs a new GameWindow with the specified attributes.</summary>
 /// <param name="width">The width of the GameWindow in pixels.</param>
 /// <param name="height">The height of the GameWindow in pixels.</param>
 /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the GameWindow.</param>
 /// <param name="title">The title of the GameWindow.</param>
 /// <param name="options">GameWindow options regarding window appearance and behavior.</param>
 /// <param name="device">The OpenTK.Graphics.DisplayDevice to construct the GameWindow in.</param>
 /// <param name="major">The major version for the OpenGL GraphicsContext.</param>
 /// <param name="minor">The minor version for the OpenGL GraphicsContext.</param>
 /// <param name="flags">The GraphicsContextFlags version for the OpenGL GraphicsContext.</param>
 public GameWindow(int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device,
     int major, int minor, GraphicsContextFlags flags)
     : this(width, height, mode, title, options, device, major, minor, flags, null)
 { }
开发者ID:sulix,项目名称:opentk-sdl2,代码行数:14,代码来源:GameWindow.cs


示例19: CreateWindow

        IntPtr CreateWindow(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device, IntPtr parentHandle)
        {
            // Use win32 to create the native window.
            // Keep in mind that some construction code runs in the WM_CREATE message handler.

            // The style of a parent window is different than that of a child window.
            // Note: the child window should always be visible, even if the parent isn't.
            WindowStyle style = 0;
            ExtendedWindowStyle ex_style = 0;
            if (parentHandle == IntPtr.Zero)
            {
                style |= WindowStyle.OverlappedWindow | WindowStyle.ClipChildren;
                ex_style = ParentStyleEx;
            }
            else
            {
                style |= WindowStyle.Visible | WindowStyle.Child | WindowStyle.ClipSiblings;
                ex_style = ChildStyleEx;
            }

            // Find out the final window rectangle, after the WM has added its chrome (titlebar, sidebars etc).
            Win32Rectangle rect = new Win32Rectangle();
            rect.left = x; rect.top = y; rect.right = x + width; rect.bottom = y + height;
            Functions.AdjustWindowRectEx(ref rect, style, false, ex_style);

            // Create the window class that we will use for this window.
            // The current approach is to register a new class for each top-level WinGLWindow we create.
            if (!class_registered)
            {
                ExtendedWindowClass wc = new ExtendedWindowClass();
                wc.Size = ExtendedWindowClass.SizeInBytes;
                wc.Style = DefaultClassStyle;
                wc.Instance = Instance;
                wc.WndProc = WindowProcedureDelegate;
                wc.ClassName = ClassName;
                wc.Icon = Icon != null ? Icon.Handle : IntPtr.Zero;
#warning "This seems to resize one of the 'large' icons, rather than using a small icon directly (multi-icon files). Investigate!"
                wc.IconSm = Icon != null ? new Icon(Icon, 16, 16).Handle : IntPtr.Zero;
                wc.Cursor = Functions.LoadCursor(CursorName.Arrow);
                ushort atom = Functions.RegisterClassEx(ref wc);

                if (atom == 0)
                    throw new PlatformException(String.Format("Failed to register window class. Error: {0}", Marshal.GetLastWin32Error()));

                class_registered = true;
            }

            IntPtr window_name = Marshal.StringToHGlobalAuto(title);
            IntPtr handle = Functions.CreateWindowEx(
                ex_style, ClassName, window_name, style,
                rect.left, rect.top, rect.Width, rect.Height,
                parentHandle, IntPtr.Zero, Instance, IntPtr.Zero);

            if (handle == IntPtr.Zero)
                throw new PlatformException(String.Format("Failed to create window. Error: {0}", Marshal.GetLastWin32Error()));

            return handle;
        }
开发者ID:raphaelts3,项目名称:opentk,代码行数:58,代码来源:WinGLNative.cs


示例20: WinGLNative

        public WinGLNative(int x, int y, int width, int height, string title, GameWindowFlags options, DisplayDevice device)
        {
            lock (SyncRoot)
            {
                // This is the main window procedure callback. We need the callback in order to create the window, so
                // don't move it below the CreateWindow calls.
                WindowProcedureDelegate = WindowProcedure;

                //// This timer callback is called periodically when the window enters a sizing / moving modal loop.
                //ModalLoopCallback = delegate(IntPtr handle, WindowMessage msg, UIntPtr eventId, int time)
                //{
                //    // Todo: find a way to notify the frontend that it should process queued up UpdateFrame/RenderFrame events.
                //    if (Move != null)
                //        Move(this, EventArgs.Empty);
                //};

                int scale_width = width;
                int scale_height = height;
                int scale_x = x;
                int scale_y = y;
                if (Toolkit.Options.EnableHighResolution)
                {
                    // CreateWindow takes values in pixels.
                    // According to the high-dpi guidelines,
                    // we need to scale these values by the
                    // current DPI.
                    // Search MSDN for "How to Ensure That
                    // Your Application Displays Properly on
                    // High-DPI Displays"
                    scale_width = ScaleX(width);
                    scale_height = ScaleY(height);
                    scale_x = ScaleX(x);
                    scale_y = ScaleY(y);
                }

                // To avoid issues with Ati drivers on Windows 6+ with compositing enabled, the context will not be
                // bound to the top-level window, but rather to a child window docked in the parent.
                window = new WinWindowInfo(
                    CreateWindow(
                        scale_x, scale_y, scale_width, scale_height,
                        title, options, device, IntPtr.Zero),
                    null);
                child_window = new WinWindowInfo(
                    CreateWindow(
                        0, 0, ClientSize.Width, ClientSize.Height,
                        title, options, device, window.Handle),
                    window);

                exists = true;

                keyboard.Description = "Standard Windows keyboard";
                keyboard.NumberOfFunctionKeys = 12;
                keyboard.NumberOfKeys = 101;
                keyboard.NumberOfLeds = 3;

                mouse.Description = "Standard Windows mouse";
                mouse.NumberOfButtons = 3;
                mouse.NumberOfWheels = 1;

                keyboards.Add(keyboard);
                mice.Add(mouse);
            }
        }
开发者ID:raphaelts3,项目名称:opentk,代码行数:63,代码来源:WinGLNative.cs



注:本文中的GameWindowFlags类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Gamma类代码示例发布时间:2022-05-24
下一篇:
C# GameVersion类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap