From 4ec7e493520d558dd05e911b58ea354d25f33f45 Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Mon, 28 May 2018 11:40:30 +0100 Subject: Started animated implementation --- unicorn/FakeUnicorn2.go | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 unicorn/FakeUnicorn2.go (limited to 'unicorn/FakeUnicorn2.go') diff --git a/unicorn/FakeUnicorn2.go b/unicorn/FakeUnicorn2.go new file mode 100644 index 0000000..73ce8ab --- /dev/null +++ b/unicorn/FakeUnicorn2.go @@ -0,0 +1,57 @@ +package unicorn + +import ( + "image" + + "github.com/veandco/go-sdl2/sdl" +) + +type FakeUnicorn2 struct { + BaseUnicorn2 +} + +func renderImage(im image.Image) { + // b := im.Bounds() + // width := b.Dx() + // height := b.Dy() + // for x := 0; x < width; x++ { + // for y := 0; y < height; y++ { + // r, g, b, _ := im.At(x, y).RGBA() + // un.SetPixel(uint8(x), uint8(y), uint8(r), uint8(g), uint8(b)) + // } + // } + // un.Show() +} + +func render() { + // for !stop { + // for i := 0; i < len(gf.Image); i++ { + // im := gf.Image[i] + // delay := gf.Delay[i] //100ths of a second + // renderImage(un, im) + // time.Sleep(time.Duration(delay * 10000000)) // nanoseconds 10^-9 sec + // } + // } +} + +func (u *FakeUnicorn2) StartRender() { + +} + +func MainLoop() { + running := true + for running { + for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() { + switch event.(type) { + case *sdl.QuitEvent: + println("Quit") + running = false + break + } + } + } +} + +func NewUnicorn2() *FakeUnicorn2 { + return &FakeUnicorn2{} +} -- cgit v1.2.3-ZIG