mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-06 16:04:29 +01:00
Updated FAQ (markdown)
parent
d6f0ca37c4
commit
c74ac1e752
22
FAQ.md
22
FAQ.md
@ -32,26 +32,10 @@ See [the discussion #137](https://github.com/hajimehoshi/ebiten/issues/137) on o
|
||||
|
||||
## How to take a screenshot?
|
||||
|
||||
As a `ebiten.Image` is just a standard `image.Image`, you can pass it to, e.g. `png.Encode`.
|
||||
Specify the key to environment variable `EBITEN_SCREENSHOT_KEY` and you can take a screenshot by pressing the specified key.
|
||||
|
||||
```go
|
||||
func update(screen *ebiten.Image) error {
|
||||
// update logic
|
||||
|
||||
// render to the screen
|
||||
|
||||
if needsToTakeScreenshot {
|
||||
f, err := os.Create("screen.png")
|
||||
defer f.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := png.Encode(f, screen); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
```sh
|
||||
EBITEN_SCREENSHOT_KEY=escape go run examples/flappy.go
|
||||
```
|
||||
|
||||
## Ebiten's screen is scaled (and blurred) on high-DPI screen. Can I disable this scaling? In other words, can I have a high-DPI mode?
|
||||
|
Loading…
Reference in New Issue
Block a user