Start Siv3D for Web programming with Unix + Visual Studio Code¶
We are offering Siv3D for web as an experimental feature. The web version has some caveats, so it is intended for intermediate and above users who are familiar with using Siv3D. If you have any trouble using it, please ask on the #web
channel of the Siv3D Discord server.
1. System requirements¶
1.1 Developer System Requirements¶
It is a development environment necessary for OpenSiv3D v0.6.9 programming in Visual Studio Code.
OS | Windows 7 SP1 (64-bit) / Windows 8.1 (64-bit) / Windows 10 (64-bit) / macOS Monterey or later / Ubuntu 20.04 LTS / Ubuntu 22.04 LTS |
CPU | Intel or AMD CPU |
映像出力 | Have some sort of video output device, such as a monitor |
音声出力 | have some kind of audio output device |
開発環境 | emscripten compiler frontend 3.1.20 |
ブラウザ | |
1.2 Application operating system requirements¶
This environment is required to run applications developed using OpenSiv3D v0.6.6 Web version. It would be a good idea to include it in the instructions when distributing the game or application.
OS | Windows 7 SP1 (64-bit) / Windows 8.1 (64-bit) / Windows 10 (64-bit) / macOS Monterey 以降 / Ubuntu 20.04 LTS / Ubuntu 22.04 LTS |
CPU | Intel または AMD 製の CPU |
映像出力 | Have some sort of video output device, such as a monitor |
音声出力 | 何らかの音声出力装置があること |
ブラウザ | |
2. Setting up the development environment¶
2.1 Installing the compiler¶
-
Download the contents of the repository from ** GitHub - emscripten-core/emsdk **. Press the green
Code
button, thenDownload ZIP
button. Then, the contents of the repository will be downloaded as a .zip file, so extract it to an appropriate folder. -
Open a terminal in the folder where you extracted emsdk and run the following commands line by line.
-
Copy the last line of the command output, paste it into the terminal, and run it. Depending on your environment, you should see a line like this:
2.2 Installing the Visual Studio Code extension¶
-
Search for and install extensions by entering the following names in the Extensions tab on the left:
-
C/C++ VSCode extension
- Debugger for Firefox
- WebAssembly on Chrome Debugger
3. Download the project template¶
- Download the project template from the project template repository by pressing the green
Code
button followed byDownload ZIP
button. Once downloaded, unzip the file
4. Building the Siv3D App¶
- Open the folder with your project template in Visual Studio Code
- A sample program (Main.cpp) is prepared from the beginning
- Select
Launch Chrome against localhost
orLaunch Firefox against localhost
in the Run and Debug tab and press the Run button ▶️. - A running program ends when you press Esc or close the browser tab
5. Other notes¶
- The web version of the scene resize mode defaults to
ResizeMode::Virtual
, so the scene resizes as the browser scales. To prevent this, fix the scene size withScene::SetResizeMode(ResizeMode::Keep);
andScene::Resize(width, height);