Windows

Hajime Hoshi edited this page Oct 14, 2018 · 38 revisions

See installation.

Compilation requires a C compiler like GCC to compile third party libraries used by Ebiten. You would need C compiler like MinGW on Windows. Visual Studio is not tested.

Ebiten is also tested on Windows Subsystem for Linux. Don't forget to install MinGW and add GOOS=windows when building.

How to install

Install Git

Option 1. Git official

You can get the official installer. Git is required before go get.

Add the below values to PATH environment variable:

  • For 32bit, C:\Program Files\Git\bin
  • For 64bit, C:\Program Files (x86)\Git\bin

Option 2. Scoop

You also can get Git via Scoop.

scoop install git

Install C compiler

A C compiler is also required before go get. There are some options.

Option 1. MinGW official

Get the installer from MinGW (or MinGW-w64 for 64bit Windows) and install it, then set PATH environment variable. It might be hard to find where to download the installer, and in this case, using scoops would be a good option.

Option 2. Scoop

You also can get MinGW via Scoop. This is the easiest way.

scoop install gcc

Option 3. TDM GCC

Get the installer from TDM GCC and install it. PATH will be set by the install so you don't have to care. The problem is that TDM GCC is not updated recently, and the last update was in 2015.

Run examples

To check installation finished correctly, let's execute an example.

cd %GOPATH%\src\github.com\hajimehoshi\ebiten\examples
go run -tags=example rotate\main.go

Windows Subsystem for Linux

  1. Install 'Windows for Subsystem for Linux (https://docs.microsoft.com/en-us/windows/wsl/install-win10)
  2. Install 'Ubuntu' via Windows Store

In the Ubuntu:

  1. Set up (add a new user)
  2. sudo apt update
  3. sudo apt upgrade
  4. sudo apt install mingw-w64
  5. Install Linux 'Go' downloaded from https://golang.org (Linux version is required. The download directory is typically /mnt/c/Users/(yourname)/Downloads)

If you use go modules, that's done! Ebiten will be downloaded automatically if your lib depends on Ebiten. For example:

mkdir test
cd test
go mod init example.com/m

# When cross-compiling, cgo is disabled by default.
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows go get github.com/hajimehoshi/ebiten@master
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows go build -tags=example github.com/hajimehoshi/ebiten/examples/rotate

Then copy rotate.exe to somewhere and open this from Windows.

If you don't, let's go-get:

GO111MODULE=off go get -u github.com/hajimehoshi/ebiten/...

Cross Compiling

It is possible to cross-compile Ebiten games for windows, see: Cross Compiling

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.