# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lados-organization.gitbook.io/goku/chapter-16-the-window-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
