From 5afaaf0432d4c9b6c2d840492eff184af41c961e Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Mon, 28 May 2018 16:58:04 +0100 Subject: TestGif.go tests showing a simple animated GIF using new Unicorn2 interface --- TestGif.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 TestGif.go diff --git a/TestGif.go b/TestGif.go new file mode 100644 index 0000000..ab4e33a --- /dev/null +++ b/TestGif.go @@ -0,0 +1,33 @@ +// +build ignore + +package main + +import ( + "bytes" + "image/gif" + "log" + + "github.com/MFAshby/unicornpaint/unicorn" +) + +func main() { + un, err := unicorn.NewUnicorn2() + if err != nil { + log.Fatalf("Error getting a unicorn :( %v", err) + } + + data, err := unicorn.Asset("data/sample2.gif") + if err != nil { + log.Fatalf("Error getting rain %v", err) + } + + g, err := gif.DecodeAll(bytes.NewReader(data)) + if err != nil { + log.Fatalf("Error decoding gif %v", err) + } + + un.SetGif(g) + stopChan := un.StartRender() + un.MainLoop() + stopChan <- true +} -- cgit v1.2.3-ZIG