当前位置: 首页>>代码示例>>C#>>正文


C# OpenTK.DisplayDevice类代码示例

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


DisplayDevice类属于OpenTK命名空间,在下文中一共展示了DisplayDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例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: TryChangeResolution

 public override sealed bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
 {
     IntPtr num1 = QuartzDisplayDeviceDriver.HandleTo(device);
       IntPtr num2 = CG.DisplayCurrentMode(num1);
       if (!this.storedModes.ContainsKey(num1))
     this.storedModes.Add(num1, num2);
       CFArray cfArray = new CFArray(CG.DisplayAvailableModes(num1));
       for (int index = 0; index < cfArray.Count; ++index)
       {
     CFDictionary cfDictionary = new CFDictionary(cfArray[index]);
     int num3 = (int) cfDictionary.GetNumberValue("Width");
     int num4 = (int) cfDictionary.GetNumberValue("Height");
     int num5 = (int) cfDictionary.GetNumberValue("BitsPerPixel");
     double numberValue = cfDictionary.GetNumberValue("RefreshRate");
     if (num3 == resolution.Width && num4 == resolution.Height && (num5 == resolution.BitsPerPixel && Math.Abs(numberValue - (double) resolution.RefreshRate) < 1E-06))
     {
       if (!this.displaysCaptured.Contains(num1))
       {
     int num6 = (int) CG.DisplayCapture(num1);
       }
       CG.DisplaySwitchToMode(num1, cfArray[index]);
       return true;
     }
       }
       return false;
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:26,代码来源:QuartzDisplayDeviceDriver.cs

示例5: TryChangeResolution

 public override sealed bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
 {
     if (this.xrandr_supported)
     return this.ChangeResolutionXRandR(device, resolution);
       if (this.xf86_supported)
     return X11DisplayDevice.ChangeResolutionXF86(device, resolution);
       else
     return false;
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:9,代码来源:X11DisplayDevice.cs

示例6: COutput

        public COutput(DisplayDevice glDisplayDevice, int index)
        {
            this.glDisplayDevice = glDisplayDevice;

            outputDesc = new OutputDescription
            {
                DeviceName = string.Format("Display{0}", index.ToString(CultureInfo.InvariantCulture)),
                DesctopCoordinates = new Rectangle(),
                AttachedToDesctop = false,
                Rotation = ModeRotation.Unspecified,
                MonitorHandle = glDisplayDevice
            };
        }
开发者ID:Zulkir,项目名称:Beholder,代码行数:13,代码来源:COutput.cs

示例7: TryChangeResolution

 public override sealed bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
 {
     DeviceMode lpDevMode = (DeviceMode) null;
       if (resolution != (DisplayResolution) null)
       {
     lpDevMode = new DeviceMode();
     lpDevMode.PelsWidth = resolution.Width;
     lpDevMode.PelsHeight = resolution.Height;
     lpDevMode.BitsPerPel = resolution.BitsPerPixel;
     lpDevMode.DisplayFrequency = (int) resolution.RefreshRate;
     lpDevMode.Fields = 6029312;
       }
       return 0 == Functions.ChangeDisplaySettingsEx((string) device.Id, lpDevMode, IntPtr.Zero, ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero);
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:14,代码来源:WinDisplayDeviceDriver.cs

示例8: 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

示例9: DisplayResolution

        /// <summary>
        /// Creates a new DisplayResolution object for the specified DisplayDevice.
        /// </summary>
        /// <param name="width">The requested width in pixels.</param>
        /// <param name="height">The requested height in pixels.</param>
        /// <param name="bitsPerPixel">The requested bits per pixel in bits.</param>
        /// <param name="refreshRate">The requested refresh rate in hertz.</param>
        /// <remarks>OpenTK will select the closest match between all available resolutions on the specified DisplayDevice.</remarks>
        /// 
        public DisplayResolution(int width, int height, int bitsPerPixel, float refreshRate, DisplayDevice device)
        {
            // Refresh rate may be zero, since this information may not be available on some platforms.
            if (width <= 0) throw new ArgumentOutOfRangeException("width", "Must be greater than zero.");
            if (height <= 0) throw new ArgumentOutOfRangeException("height", "Must be greater than zero.");
            if (bitsPerPixel <= 0) throw new ArgumentOutOfRangeException("bitsPerPixel", "Must be greater than zero.");
            if (refreshRate < 0) throw new ArgumentOutOfRangeException("refreshRate", "Must be greater than, or equal to zero.");
            if (device == null) throw new ArgumentNullException("DisplayDevice", "Must be a valid DisplayDevice");

            DisplayResolution res = device.SelectResolution(width, height, bitsPerPixel, refreshRate);

            this.width = res.width;
            this.height = res.height;
            this.bits_per_pixel = res.bits_per_pixel;
            this.refresh_rate = res.refresh_rate;
        }
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:25,代码来源:DisplayResolution.cs

示例10: RenderWindow

        public RenderWindow(int width, int height, DisplayDevice device)
            : base(width, height, "RenderOutput", GameWindowFlags.Default, GraphicsMode.Default, device == null ? DisplayDevice.AvailableDisplays.FirstOrDefault(row => row.IsPrimary) : device)
        {
            try
            {
                glContext = new GraphicsContext(GraphicsMode.Default, WindowInfo, 2, 0, GraphicsContextFlags.Default);
                glContext.MakeCurrent(WindowInfo);
                (glContext as IGraphicsContextInternal).LoadAll();

                //glWindow.WindowInfoChanged += delegate(object sender, EventArgs e) { OnWindowInfoChangedInternal(e); };
            }
            catch (Exception e)
            {
                base.Dispose();
                throw;
            }
        }
开发者ID:virrkharia,项目名称:dynamight,代码行数:17,代码来源:RenderWindow.cs

示例11: 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

示例12: 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

示例13: 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

示例14: QuartzDisplayDeviceDriver

 public unsafe QuartzDisplayDeviceDriver()
 {
     lock (QuartzDisplayDeviceDriver.display_lock)
       {
     IntPtr[] local_0 = new IntPtr[20];
     int local_1;
     fixed (IntPtr* fixed_0 = local_0)
     {
       int temp_15 = (int) CG.GetActiveDisplayList(20, fixed_0, out local_1);
     }
     for (int local_3 = 0; local_3 < local_1; ++local_3)
     {
       IntPtr local_4 = local_0[local_3];
       bool local_5 = local_3 == 0;
       CG.DisplayPixelsWide(local_4);
       CG.DisplayPixelsHigh(local_4);
       CFArray local_7 = new CFArray(CG.DisplayAvailableModes(local_4));
       DisplayResolution local_8 = (DisplayResolution) null;
       List<DisplayResolution> local_9 = new List<DisplayResolution>();
       CFDictionary local_11 = new CFDictionary(CG.DisplayCurrentMode(local_4));
       for (int local_12 = 0; local_12 < local_7.Count; ++local_12)
       {
     CFDictionary local_13 = new CFDictionary(local_7[local_12]);
     int local_14 = (int) local_13.GetNumberValue("Width");
     int local_15 = (int) local_13.GetNumberValue("Height");
     int local_16 = (int) local_13.GetNumberValue("BitsPerPixel");
     double local_17 = local_13.GetNumberValue("RefreshRate");
     bool local_18 = local_11.Ref == local_13.Ref;
     DisplayResolution local_19 = new DisplayResolution(0, 0, local_14, local_15, local_16, (float) local_17);
     local_9.Add(local_19);
     if (local_18)
       local_8 = local_19;
       }
       HIRect local_20 = CG.DisplayBounds(local_4);
       Rectangle local_21 = new Rectangle((int) local_20.Origin.X, (int) local_20.Origin.Y, (int) local_20.Size.Width, (int) local_20.Size.Height);
       DisplayDevice local_22 = new DisplayDevice(local_8, local_5, (IEnumerable<DisplayResolution>) local_9, local_21, (object) local_4);
       this.AvailableDevices.Add(local_22);
       if (local_5)
     this.Primary = local_22;
     }
       }
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:42,代码来源:QuartzDisplayDeviceDriver.cs

示例15: 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


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