mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Add example for RecordScreenAsGIF
This commit is contained in:
parent
6f5d106b37
commit
4bf4b0c264
@ -56,6 +56,25 @@ func (r *recorder) update(screen *ebiten.Image) error {
|
||||
// RecordScreenAsGIF returns updating function with recording the screen as an animation GIF image.
|
||||
//
|
||||
// This encodes each screen at each frame and may slows the application.
|
||||
//
|
||||
// Here is the example to record initial 120 frames of your game:
|
||||
//
|
||||
// func update(screen *ebiten.Image) error {
|
||||
// // ...
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// out, err := os.Create("output.gif")
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
// defer out.Close()
|
||||
//
|
||||
// update := RecordScreenAsGIF(update, out, 120)
|
||||
// if err := ebiten.Run(update, 320, 240, 2, "Your game's title"); err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
// }
|
||||
func RecordScreenAsGIF(update func(*ebiten.Image) error, out io.Writer, frameNum int) func(*ebiten.Image) error {
|
||||
r := &recorder{
|
||||
inner: update,
|
||||
|
Loading…
Reference in New Issue
Block a user