本文整理汇总了C#中DisplayDevice类的典型用法代码示例。如果您正苦于以下问题:C# DisplayDevice类的具体用法?C# DisplayDevice怎么用?C# DisplayDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DisplayDevice类属于命名空间,在下文中一共展示了DisplayDevice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Load
public override void Load()
{
_screens = new List<Screen>(Screen.AllScreens);
IList<String> options = new List<String>();
options.Add("[Settings.Appearance.System.StartupScreen.DoNotUseSelection]");
foreach (Screen screen in Screen.AllScreens)
{
const int dwf = 0;
DisplayDevice info = new DisplayDevice();
string monitorname = null;
info.cb = Marshal.SizeOf(info);
if (EnumDisplayDevices(screen.DeviceName, 0, info, dwf))
monitorname = info.DeviceString;
options.Add(string.Format("{0} ({1}x{2})", monitorname, screen.Bounds.Width, screen.Bounds.Height));
}
int startupScreenNum = SettingsManager.Load<StartupSettings>().StartupScreenNum;
if (startupScreenNum < Screen.AllScreens.Length)
Selected = SettingsManager.Load<StartupSettings>().StartupScreenNum + 1;
else
Selected = 0;
_items = options.Select(LocalizationHelper.CreateResourceString).ToList();
}
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:27,代码来源:StartupScreen.cs
示例2: 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
示例3: X11DisplayDevice
static X11DisplayDevice()
{
List<DisplayDevice> devices = new List<DisplayDevice>();
try {
xinerama_supported = QueryXinerama(devices);
} catch {
Debug.Print("Xinerama query failed.");
}
if (!xinerama_supported) {
// We assume that devices are equivalent to the number of available screens.
// Note: this won't work correctly in the case of distinct X servers.
for (int i = 0; i < API.ScreenCount; i++) {
DisplayDevice dev = new DisplayDevice();
dev.IsPrimary = i == API.XDefaultScreen(API.DefaultDisplay);
devices.Add(dev);
deviceToScreen.Add(dev, i);
}
}
try {
xrandr_supported = QueryXRandR(devices);
} catch { }
if (!xrandr_supported) {
Debug.Print("XRandR query failed, falling back to XF86.");
try {
xf86_supported = QueryXF86(devices);
} catch { }
if (!xf86_supported) {
Debug.Print("XF86 query failed, no DisplayDevice support available.");
}
}
}
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:35,代码来源:X11DisplayDevice.cs
示例4: 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
示例5: WinDisplayDeviceDriver
new Dictionary<DisplayDevice, string>(); // Needed for ChangeDisplaySettingsEx
#region --- Constructors ---
/// <summary>Queries available display devices and display resolutions.</summary>
static WinDisplayDeviceDriver()
{
lock (display_lock)
{
// To minimize the need to add static methods to OpenTK.Graphics.DisplayDevice
// we only allow settings to be set through its constructor.
// Thus, we save all necessary parameters in temporary variables
// and construct the device when every needed detail is available.
// The main DisplayDevice constructor adds the newly constructed device
// to the list of available devices.
DisplayDevice opentk_dev;
DisplayResolution opentk_dev_current_res = null;
List<DisplayResolution> opentk_dev_available_res = new List<DisplayResolution>();
bool opentk_dev_primary = false;
int device_count = 0, mode_count = 0;
// Get available video adapters and enumerate all monitors
WindowsDisplayDevice dev1 = new WindowsDisplayDevice(), dev2 = new WindowsDisplayDevice();
while (Functions.EnumDisplayDevices(null, device_count++, dev1, 0))
{
if ((dev1.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) == DisplayDeviceStateFlags.None)
continue;
DeviceMode monitor_mode = new DeviceMode();
// The second function should only be executed when the first one fails
// (e.g. when the monitor is disabled)
if (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.CurrentSettings, monitor_mode, 0) ||
Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.RegistrySettings, monitor_mode, 0))
{
opentk_dev_current_res = new DisplayResolution(
monitor_mode.Position.X, monitor_mode.Position.Y,
monitor_mode.PelsWidth, monitor_mode.PelsHeight,
monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency);
opentk_dev_primary =
(dev1.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None;
}
opentk_dev_available_res.Clear();
mode_count = 0;
while (Functions.EnumDisplaySettings(dev1.DeviceName.ToString(), mode_count++, monitor_mode))
{
DisplayResolution res = new DisplayResolution(
monitor_mode.Position.X, monitor_mode.Position.Y,
monitor_mode.PelsWidth, monitor_mode.PelsHeight,
monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency);
opentk_dev_available_res.Add(res);
}
// Construct the OpenTK DisplayDevice through the accumulated parameters.
// The constructor will automatically add the DisplayDevice to the list
// of available devices.
opentk_dev = new DisplayDevice(
opentk_dev_current_res,
opentk_dev_primary,
opentk_dev_available_res,
opentk_dev_current_res.Bounds);
available_device_names.Add(opentk_dev, dev1.DeviceName);
}
}
}
开发者ID:prepare,项目名称:HTML-Renderer,代码行数:62,代码来源:WinDisplayDevice.cs
示例6: 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
示例7: TryChangeResolution
public sealed override bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
{
DeviceMode mode = null;
if (resolution != null)
{
mode = new DeviceMode();
mode.PelsWidth = resolution.Width;
mode.PelsHeight = resolution.Height;
mode.BitsPerPel = resolution.BitsPerPixel;
mode.DisplayFrequency = (int)resolution.RefreshRate;
mode.Fields = Constants.DM_BITSPERPEL
| Constants.DM_PELSWIDTH
| Constants.DM_PELSHEIGHT
| Constants.DM_DISPLAYFREQUENCY;
}
return Constants.DISP_CHANGE_SUCCESSFUL ==
Functions.ChangeDisplaySettingsEx((string)device.Id, mode, IntPtr.Zero,
ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero);
}
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:21,代码来源:WinDisplayDevice.cs
示例8: Sdl2DisplayDeviceDriver
public Sdl2DisplayDeviceDriver()
{
int displays = SDL.GetNumVideoDisplays();
for (int d = 0; d < displays; d++)
{
Rect bounds;
SDL.GetDisplayBounds(d, out bounds);
DisplayMode current_mode;
SDL.GetCurrentDisplayMode(d, out current_mode);
var mode_list = new List<DisplayResolution>();
int num_modes = SDL.GetNumDisplayModes(d);
for (int m = 0; m < num_modes; m++)
{
DisplayMode sdl_mode;
SDL.GetDisplayMode(d, m, out sdl_mode);
mode_list.Add(new DisplayResolution(
bounds.X, bounds.Y,
sdl_mode.Width, sdl_mode.Height,
TranslateFormat(sdl_mode.Format),
sdl_mode.RefreshRate));
}
var current_resolution = new DisplayResolution(
bounds.X, bounds.Y,
current_mode.Width, current_mode.Height,
TranslateFormat(current_mode.Format),
current_mode.RefreshRate);
var device = new DisplayDevice(
current_resolution, d == 0, mode_list, TranslateBounds(bounds), d);
AvailableDevices.Add(device);
if (d == 0)
Primary = device;
}
}
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:38,代码来源:Sdl2DisplayDeviceDriver.cs
示例9: RefreshDisplayDevices
void RefreshDisplayDevices ()
{
List<DisplayDevice> devices = new List<DisplayDevice> ();
int numVideoDevices = 0;
lock (API.sdl_api_lock) {
numVideoDevices = API.GetNumVideoDisplays ();
}
for (int i = 0; i < numVideoDevices; ++i)
{
DisplayDevice dev = new DisplayDevice();
List<DisplayResolution> resolutions = new List<DisplayResolution>();
if (i == 0) dev.IsPrimary = true;
int numResolutions = 0;
lock (API.sdl_api_lock) {
numResolutions = API.GetNumDisplayModes(i);
}
for (int res = 0; res < numResolutions; ++res)
{
lock (API.sdl_api_lock)
{
API.DisplayMode modeRect;
API.GetDisplayMode(i, res, out modeRect);
resolutions.Add (new DisplayResolution(0, 0, modeRect.w, modeRect.h, 32, modeRect.refresh_rate));
}
}
dev.AvailableResolutions = resolutions;
devices.Add(dev);
}
AvailableDevices.Clear();
AvailableDevices.AddRange(devices);
Primary = FindDefaultDevice(devices);
}
开发者ID:sulix,项目名称:opentk-sdl2,代码行数:36,代码来源:SDL2DisplayDevice.cs
示例10: 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);
//};
// 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;
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:Terracorrupt,项目名称:duality,代码行数:38,代码来源:WinGLNative.cs
示例11: CreateNativeWindow
public INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title,
GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
{
return default_implementation.CreateNativeWindow(x, y, width, height, title, mode, options, device);
}
开发者ID:dakahler,项目名称:alloclave,代码行数:5,代码来源:Factory.cs
示例12: DisplayConfig
private string displayConfigFriendlyName; // provided by DisplayConfig (if supported)
/// <summary>Initializes a new <see cref="DisplayMonitor"/> instance.</summary>
/// <param name="displayDevice">A valid <see cref="DisplayDevice"/> structure.</param>
/// <param name="monitorHandle">A handle (HMONITOR) to the monitor.</param>
internal DisplayMonitor( DisplayDevice displayDevice, IntPtr monitorHandle )
: base( displayDevice )
{
info = GetMonitorInfo( handle = monitorHandle );
}
开发者ID:YHiniger,项目名称:ManagedX.Display,代码行数:12,代码来源:DisplayMonitor.cs
示例13: HandleTo
static internal IntPtr HandleTo(DisplayDevice displayDevice)
{
return (IntPtr)displayDevice.Id;
}
开发者ID:Munk801,项目名称:Journey-to-the-West-Video-Game,代码行数:4,代码来源:QuartzDisplayDeviceDriver.cs
示例14: TryRestoreResolution
public bool TryRestoreResolution(DisplayDevice device)
{
return TryChangeResolution(device, null);
}
开发者ID:jcnossen,项目名称:upspring.net,代码行数:4,代码来源:WinDisplayDevice.cs
示例15: TryRestoreResolution
public override bool TryRestoreResolution(DisplayDevice device)
{
Sdl2Factory.UseFullscreenDesktop = true;
return true;
}
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:5,代码来源:Sdl2DisplayDeviceDriver.cs
示例16: TryChangeResolution
public override bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
{
Sdl2Factory.UseFullscreenDesktop = false;
return true;
}
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:5,代码来源:Sdl2DisplayDeviceDriver.cs
示例17: CocoaNativeWindow
private MouseCursor selectedCursor = MouseCursor.Default; // user-selected cursor
public CocoaNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)
{
// Create the window class
Interlocked.Increment(ref UniqueId);
windowClass = Class.AllocateClass("OpenTK_GameWindow" + UniqueId, "NSWindow");
Class.RegisterMethod(windowClass, new WindowKeyDownDelegate(WindowKeyDown), "keyDown:", "[email protected]:@");
Class.RegisterMethod(windowClass, new WindowDidResizeDelegate(WindowDidResize), "windowDidResize:", "[email protected]:@");
Class.RegisterMethod(windowClass, new WindowDidMoveDelegate(WindowDidMove), "windowDidMove:", "[email protected]:@");
Class.RegisterMethod(windowClass, new WindowDidBecomeKeyDelegate(WindowDidBecomeKey), "windowDidBecomeKey:", "[email protected]:@");
Class.RegisterMethod(windowClass, new WindowDidResignKeyDelegate(WindowDidResignKey), "windowDidResignKey:", "[email protected]:@");
Class.RegisterMethod(windowClass, new WindowWillMiniaturizeDelegate(WindowWillMiniaturize), "windowWillMiniaturize:", "[email protected]:@");
Class.RegisterMethod(windowClass, new WindowDidMiniaturizeDelegate(WindowDidMiniaturize), "windowDidMiniaturize:", "[email protected]:@");
Class.RegisterMethod(windowClass, new WindowDidDeminiaturizeDelegate(WindowDidDeminiaturize), "windowDidDeminiaturize:", "[email protected]:@");
Class.RegisterMethod(windowClass, new WindowShouldZoomToFrameDelegate(WindowShouldZoomToFrame), "windowShouldZoom:toFrame:", "[email protected]:@{NSRect={NSPoint=ff}{NSSize=ff}}");
Class.RegisterMethod(windowClass, new WindowShouldCloseDelegate(WindowShouldClose), "windowShouldClose:", "[email protected]:@");
Class.RegisterMethod(windowClass, new AcceptsFirstResponderDelegate(AcceptsFirstResponder), "acceptsFirstResponder", "[email protected]:");
Class.RegisterMethod(windowClass, new CanBecomeKeyWindowDelegate(CanBecomeKeyWindow), "canBecomeKeyWindow", "[email protected]:");
Class.RegisterMethod(windowClass, new CanBecomeMainWindowDelegate(CanBecomeMainWindow), "canBecomeMainWindow", "[email protected]:");
Class.RegisterClass(windowClass);
IntPtr viewClass = Class.AllocateClass("OpenTK_NSView" + UniqueId, "NSView");
Class.RegisterMethod(viewClass, new ResetCursorRectsDelegate(ResetCursorRects), "resetCursorRects", "[email protected]:");
Class.RegisterClass(viewClass);
// Create window instance
// Note: The coordinate system of Cocoa places (0,0) at the bottom left.
// We need to get the height of the main screen and flip that in order
// to place the window at the correct position.
// Note: NSWindows are laid out relative to the main screen.
var screenRect =
Cocoa.SendRect(
Cocoa.SendIntPtr(
Cocoa.SendIntPtr(Class.Get("NSScreen"), Selector.Get("screens")),
Selector.Get("objectAtIndex:"), 0),
Selector.Get("frame"));
var contentRect = new System.Drawing.RectangleF(x, screenRect.Height - height - y, width, height);
var style = GetStyleMask(windowBorder);
var bufferingType = NSBackingStore.Buffered;
IntPtr windowPtr;
windowPtr = Cocoa.SendIntPtr(windowClass, Selector.Alloc);
windowPtr = Cocoa.SendIntPtr(windowPtr, Selector.Get("initWithContentRect:styleMask:backing:defer:"), contentRect, (int)style, (int)bufferingType, false);
// Replace view with our custom implementation
// that overrides resetCursorRects (maybe there is
// a better way to implement this override?)
// Existing view:
IntPtr viewPtr = Cocoa.SendIntPtr(windowPtr, Selector.Get("contentView"));
// Our custom view with the same bounds:
viewPtr = Cocoa.SendIntPtr(
Cocoa.SendIntPtr(viewClass, Selector.Alloc),
Selector.Get("initWithFrame:"),
Cocoa.SendRect(viewPtr, selBounds));
if (viewPtr != IntPtr.Zero)
{
Cocoa.SendVoid(windowPtr, Selector.Get("setContentView:"), viewPtr);
}
windowInfo = new CocoaWindowInfo(windowPtr);
// Set up behavior
Cocoa.SendIntPtr(windowPtr, Selector.Get("setDelegate:"), windowPtr); // The window class acts as its own delegate
Cocoa.SendVoid(windowPtr, Selector.Get("makeKeyWindow"));
SetTitle(title, false);
ResetTrackingArea();
exists = true;
NSApplication.Quit += ApplicationQuit;
}
开发者ID:RetroAchievements,项目名称:opentk,代码行数:72,代码来源:CocoaNativeWindow.cs
示例18: QuartzDisplayDeviceDriver
public QuartzDisplayDeviceDriver()
{
lock (display_lock)
{
// To minimize the need to add static methods to OpenTK.Graphics.DisplayDevice
// we only allow settings to be set through its constructor.
// Thus, we save all necessary parameters in temporary variables
// and construct the device when every needed detail is available.
// The main DisplayDevice constructor adds the newly constructed device
// to the list of available devices.
const int maxDisplayCount = 20;
IntPtr[] displays = new IntPtr[maxDisplayCount];
int displayCount;
unsafe
{
fixed (IntPtr* displayPtr = displays)
{
CG.GetActiveDisplayList(maxDisplayCount, displayPtr, out displayCount);
}
}
Debug.Print("CoreGraphics reported {0} display(s).", displayCount);
Debug.Indent();
for (int i = 0; i < displayCount; i++)
{
IntPtr currentDisplay = displays[i];
// according to docs, first element in the array is always the
// main display.
bool primary = (i == 0);
// gets current settings
int currentWidth = CG.DisplayPixelsWide(currentDisplay);
int currentHeight = CG.DisplayPixelsHigh(currentDisplay);
Debug.Print("Display {0} is at {1}x{2}", i, currentWidth, currentHeight);
IntPtr displayModesPtr = CG.DisplayAvailableModes(currentDisplay);
CFArray displayModes = new CFArray(displayModesPtr);
Debug.Print("Supports {0} display modes.", displayModes.Count);
DisplayResolution opentk_dev_current_res = null;
List<DisplayResolution> opentk_dev_available_res = new List<DisplayResolution>();
IntPtr currentModePtr = CG.DisplayCurrentMode(currentDisplay);
CFDictionary currentMode = new CFDictionary(currentModePtr);
for (int j = 0; j < displayModes.Count; j++)
{
CFDictionary dict = new CFDictionary(displayModes[j]);
int width = (int)dict.GetNumberValue("Width");
int height = (int)dict.GetNumberValue("Height");
int bpp = (int)dict.GetNumberValue("BitsPerPixel");
double freq = dict.GetNumberValue("RefreshRate");
bool current = currentMode.Ref == dict.Ref;
//if (current) Debug.Write(" * ");
//else Debug.Write(" ");
//Debug.Print("Mode {0} is {1}x{2}x{3} @ {4}.", j, width, height, bpp, freq);
DisplayResolution thisRes = new DisplayResolution(0, 0, width, height, bpp, (float)freq);
opentk_dev_available_res.Add(thisRes);
if (current)
opentk_dev_current_res = thisRes;
}
HIRect bounds = CG.DisplayBounds(currentDisplay);
Rectangle newRect = new Rectangle((int)bounds.Origin.X, (int)bounds.Origin.Y, (int)bounds.Size.Width, (int)bounds.Size.Height);
Debug.Print("Display {0} bounds: {1}", i, newRect);
DisplayDevice opentk_dev = new DisplayDevice(opentk_dev_current_res,
primary, opentk_dev_available_res, newRect, currentDisplay);
AvailableDevices.Add(opentk_dev);
if (primary)
Primary = opentk_dev;
}
Debug.Unindent();
}
}
开发者ID:Munk801,项目名称:Journey-to-the-West-Video-Game,代码行数:87,代码来源:QuartzDisplayDeviceDriver.cs
示例19: TryRestoreResolution
public sealed override bool TryRestoreResolution(DisplayDevice device)
{
IntPtr display = HandleTo(device);
if (storedModes.ContainsKey(display))
{
Debug.Print("Restoring resolution.");
CG.DisplaySwitchToMode(display, storedModes[display]);
CG.DisplayRelease(display);
displaysCaptured.Remove(display);
return true;
}
return false;
}
开发者ID:Munk801,项目名称:Journey-to-the-West-Video-Game,代码行数:17,代码来源:QuartzDisplayDeviceDriver.cs
示例20: TryChangeResolution
public sealed override bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
{
IntPtr display = HandleTo(device);
IntPtr currentModePtr = CG.DisplayCurrentMode(display);
if (storedModes.ContainsKey(display) == false)
{
storedModes.Add(display, currentModePtr);
}
IntPtr displayModesPtr = CG.DisplayAvailableModes(display);
CFArray displayModes = new CFArray(displayModesPtr);
for (int j = 0; j < displayModes.Count; j++)
{
CFDictionary dict = new CFDictionary(displayModes[j]);
int width = (int)dict.GetNumberValue("Width");
int height = (int)dict.GetNumberValue("Height");
int bpp = (int)dict.GetNumberValue("BitsPerPixel");
double freq = dict.GetNumberValue("RefreshRate");
if (width == resolution.Width && height == resolution.Height && bpp == resolution.BitsPerPixel && System.Math.Abs(freq - resolution.RefreshRate) < 1e-6)
{
if (displaysCaptured.Contains(display) == false)
{
CG.DisplayCapture(display);
}
Debug.Print("Changing resolution to {0}x{1}x{2}@{3}.", width, height, bpp, freq);
CG.DisplaySwitchToMode(display, displayModes[j]);
return true;
}
}
return false;
}
开发者ID:Munk801,项目名称:Journey-to-the-West-Video-Game,代码行数:39,代码来源:QuartzDisplayDeviceDriver.cs
注:本文中的DisplayDevice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论