public NativeWindowProvider(string name, int width, int height) { var graphicsMode = new GraphicsMode(new ColorFormat(32), 24, 0, 0); Window = new NativeWindow(width, height, name, GameWindowFlags.Default, graphicsMode, DisplayDevice.Default); Window.Visible = true; }
/// <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, 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 = 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; } }
/// <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, GraphicsMode mode, DisplayDevice device) { // TODO: Should a constraint be added for the position? if (width < 1) { throw new ArgumentOutOfRangeException(nameof(width), "Must be greater than zero."); } if (height < 1) { throw new ArgumentOutOfRangeException(nameof(height), "Must be greater than zero."); } if (mode == null) { throw new ArgumentNullException(nameof(mode)); } this.options = options; this.device = device; thread_id = Thread.CurrentThread.ManagedThreadId; var factory = Factory.Default; implementation = factory.CreateNativeWindow(x, y, width, height, title, mode, options, this.device); factory.RegisterResource(this); if ((options & GameWindowFlags.Fullscreen) != 0) { if (this.device != null) { this.device.ChangeResolution(width, height, mode.ColorFormat.BitsPerPixel, 0); } WindowState = WindowState.Fullscreen; } if ((options & GameWindowFlags.FixedWindow) != 0) { WindowBorder = WindowBorder.Fixed; } }
/// <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, 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"); } implementation = Factory.Default.CreateNativeWindow(x, y, width, height, title, mode, device); }
public int GetHeight(OpenTK.INativeWindow gameWindow) => gameWindow?.ClientSize.Height ?? 0;
public int GetWidth(OpenTK.INativeWindow gameWindow) => gameWindow?.ClientSize.Width ?? 0;
public void SetSize(OpenTK.INativeWindow gameWindow, AGS.API.Size size) { gameWindow.Size = new System.Drawing.Size(size.Width, size.Height); }
private void RenderLoop() { var graphicsMode = new GraphicsMode(new ColorFormat(32), 24, 0, 0); Window = new NativeWindow(RequestedWidth, RequestedHeight, Name, GameWindowFlags.Default, graphicsMode, DisplayDevice.Default); Window.Visible = true; Window.CursorVisible = false; using (GraphicsBackend = new Triton.Graphics.Backend(CoreResources, Window.Width, Window.Height, Window.WindowInfo)) { Triton.Graphics.Resources.ResourceLoaders.Init(CoreResources, GraphicsBackend, FileSystem); Triton.Graphics.Resources.ResourceLoaders.Init(GameResources, GraphicsBackend, FileSystem); RendererReady.Set(); while (Running) { Window.ProcessEvents(); if (!Window.Exists) break; CoreResources.TickResourceLoading(100); GameResources.TickResourceLoading(10); if (!GraphicsBackend.Process()) break; Thread.Sleep(1); } Running = false; } }
public void SetSize(OpenTK.INativeWindow gameWindow, AGS.API.Size size) { }
public int GetHeight(OpenTK.INativeWindow gameWindow) { return(convertPixelsToDp(_gameWindow.Height)); }
public int GetWidth(OpenTK.INativeWindow gameWindow) { return(convertPixelsToDp(_gameWindow.Width)); }
public int GetHeight(OpenTK.INativeWindow gameWindow) => Math.Max(1, gameWindow?.ClientSize.Height ?? 1);
public int GetWidth(OpenTK.INativeWindow gameWindow) => Math.Max(1, gameWindow?.ClientSize.Width ?? 1);