> For the complete documentation index, see [llms.txt](https://lados-organization.gitbook.io/goku/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lados-organization.gitbook.io/goku/chapter-16-the-window-system.md).

# Chapter 16: The Window System

The `Window` struct represents a window on the screen in which the game will be displayed. This system uses the `sdl2::video` module from the `SDL2` library in Rust.

The `Window` struct contains three fields: `sdl_context`, `video_subsystem`, and `canvas`. The `sdl_context` is the main context of the SDL library. The `video_subsystem` is a subsystem that handles the video functionalities. The `canvas` is a structure that represents the area where we can draw things.

A `Window` is created with a specific title, width, and height. The `new` function initializes SDL2, creates a window with the specified title, width, and height, and returns a `Result` which contains either a new instance of `Window` or an error message.

The window is created in the center of the screen and it's using the OpenGL context. The canvas is created in software mode, which means it uses the CPU for rendering. This is typically slower than using the GPU but is more widely supported.
