MoonWorks-docs/content/Window/_index.md

29 lines
1.1 KiB
Markdown
Raw Normal View History

2021-01-25 05:09:37 +00:00
---
title: "Window"
date: 2021-01-24T20:43:17-08:00
weight: 1
---
2021-01-25 22:59:27 +00:00
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.
2021-01-25 05:09:37 +00:00
Your game is assumed to have a window and you must pass a `WindowCreateInfo` struct when creating your `Game`.
2021-01-26 05:06:22 +00:00
- `WindowTitle` is the name of the window that will be displayed in the operating system.
2021-01-25 05:09:37 +00:00
- `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.
You can change the screen mode at runtime with the `ChangeScreenMode` method:
```cs
Window.ChangeScreenMode(ScreenMode.Fullscreen);
```
2021-03-17 19:40:36 +00:00
You can change the window size at runtime with the `SetWindowSize` method.
```cs
Window.SetWindowSize(1280, 720);
```
2021-01-25 05:09:37 +00:00
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.