# 第16章：ウィンドウシステム

`Window`構造体は、ゲームが表示される画面上のウィンドウを表します。このシステムは、Rustの`SDL2`ライブラリから`sdl2::video`モジュールを使用して実装されています。

`Window`構造体には、3つのフィールドが含まれています：`sdl_context`、`video_subsystem`、および`canvas`です。`sdl_context`はSDLライブラリのメインコンテキストです。`video_subsystem`は、ビデオ機能を処理するサブシステムです。`canvas`は、描画を行う領域を表す構造体です。

特定のタイトル、幅、および高さで`Window`が作成されます。`new`関数はSDL2を初期化し、指定されたタイトル、幅、および高さでウィンドウを作成し、`Window`の新しいインスタンスまたはエラーメッセージを含む`Result`を返します。

ウィンドウは画面の中央に作成され、OpenGLコンテキストを使用しています。キャンバスはソフトウェアモードで作成されます。これは、レンダリングにCPUを使用することを意味します。通常、GPUを使用するよりも遅いですが、広くサポートされています。


---

# 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/goku-game-engine_jp/16windoushisutemu.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.
