FAQ

General

Why do the examples use the build tag example?

With the build tag, go get -u github.com/hajimehoshi/ebiten/v2/... 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 Ebitengine creates an unknown process "Console Window Host". What is this?

This is because your app is still a console app, not a GUI app. Ebitengine 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 "Ebitengine"?

This is a portmanteau of an Ebiten and an Engine. An Ebiten is delicious.

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

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 .

Ebitengine'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.

Found a lot of unexpected holes in the result when rendering tiles. Why?

If you render tiles by SubImage, you might see unexpected pixels when

In the case of rendering tiles with scaling or rotating, we strongly recommend to use an ebiten.Image as an offscreen. Render tiles on the offscreen, then render the offscren image on the final target as you like.