aboutsummaryrefslogtreecommitdiff
path: root/unicorn/FakeUnicorn2.go
blob: 73ce8ab349d90bb3a4722c1a772c824513b10011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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{}
}