FAQ

General

Why do the examples use the build tag example?

With the build tag, go get -u github.com/hajimehoshi/ebiten/... doesn't install the example binaries in your $GOPATH/bin.

Such build tags are an idiom you can find e.g. in golang.org/x/exp/shiny/example.

My app built with Ebiten creates an unknown process "Console Window Host". What is this?

This is because your app is still a console app, not a GUI app. Ebiten tries to close the console when necessary, but the app itself is still not recognized as a GUI app. You can suppress this by specifying ldflags when go-building like this:

go build -ldflags -H=windowsgui path/to/your/game

Why did you name the lib "Ebiten"?

It's because Ebiten is delicious.

Is it possible to cross-compile an application with Ebiten?

Yes and no. If the target is Windows or Wasm, yes. Otherwise, it is almost impossible to cross-compile due to Cgo unfortunately. See also Go issue #18296.

Graphics

How to draw lines?

Use ebitenutil.DrawLine. Note that this function is only for debugging and prototyping only.

See the discussion #137 on other primitive drawings.

How to take a screenshot?

Specify the key to environment variable EBITEN_SCREENSHOT_KEY and you can take a screenshot by pressing the specified key.

EBITEN_SCREENSHOT_KEY=escape go run examples/flappy.go

Ebiten's screen is scaled (and blurred) on hi-DPI screen. Can I disable this scaling? In other words, can I have a hi-DPI mode?

You can make (ebiten.Game).Layout return a bigger size than the outside size. By multiplying the outside size by ebiten.DeviceScaleFactor(), you can get a hi-DPI game screen. For an actual example, see examples/highdpi.