From a68d5a1ff5af29c723711df296a8a921001781ec Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 19 Apr 2023 09:53:55 -0700 Subject: [PATCH] update Window documentation --- content/Window/_index.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/content/Window/_index.md b/content/Window/_index.md index ab90bfc..14d132f 100644 --- a/content/Window/_index.md +++ b/content/Window/_index.md @@ -4,7 +4,7 @@ date: 2021-01-24T20:43:17-08:00 weight: 1 --- -Window management in MoonWorks is implemented using the [SDL2](https://www.libsdl.org) library. All window management is handled through the `OSWindow` class. A reference to this class named `Window` is automatically created and can be retrieved from your `Game` subclass. +Window management in MoonWorks is implemented using the [SDL2](https://www.libsdl.org) library. All window management is handled through the `Window` class. A reference to this class named `MainWindow` is automatically created on startup and can be retrieved from your `Game` subclass. Your game is assumed to have a window and you must pass a `WindowCreateInfo` struct when creating your `Game`. @@ -12,11 +12,13 @@ Your game is assumed to have a window and you must pass a `WindowCreateInfo` str - `WindowWidth` is how wide the window will be. - `WindowHeight` is how tall the window will be. - `ScreenMode` determines whether the window will be created in windowed mode, fullscreen, or borderless fullscreen. +- `SystemResizable` specifies if the user will be able to resize the window by clicking and dragging the corners. +- `StartMaximized` specifies if the window will open at the maximum desktop resolution. -You can change the screen mode at runtime with the `ChangeScreenMode` method: +You can change the screen mode at runtime with the `SetScreenMode` method: ```cs -Window.ChangeScreenMode(ScreenMode.Fullscreen); +Window.SetScreenMode(ScreenMode.Fullscreen); ``` You can change the window size at runtime with the `SetWindowSize` method. @@ -26,3 +28,11 @@ Window.SetWindowSize(1280, 720); ``` Note that if you change the screen resolution, it is *your* responsibility to manage any graphics state that may need to change as a result of this change. + +You may specify a method to be called when the window size changes by calling `RegisterSizeChangeCallback`. + +```cs +Window.RegisterSizeChangeCallback(MySizeChangeCallback); +``` + +MoonWorks does support your application having multiple windows. To create a new Window, you can call the Window class's constructor. To make it renderable you will need to call `ClaimWindow` from the `GraphicsDevice`, which we will get to later.