add placeholder for viewer tool
This commit is contained in:
parent
feeff0796e
commit
87b9cf9967
39
tools/viewer/main.go
Normal file
39
tools/viewer/main.go
Normal file
@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import "github.com/veandco/go-sdl2/sdl"
|
||||
|
||||
func main() {
|
||||
if err := sdl.Init(sdl.INIT_EVERYTHING); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer sdl.Quit()
|
||||
|
||||
window, err := sdl.CreateWindow("test", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
|
||||
800, 600, sdl.WINDOW_SHOWN)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer window.Destroy()
|
||||
|
||||
surface, err := window.GetSurface()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
surface.FillRect(nil, 0)
|
||||
|
||||
rect := sdl.Rect{X: 0, Y: 0, W: 200, H: 200}
|
||||
surface.FillRect(&rect, 0xffff0000)
|
||||
window.UpdateSurface()
|
||||
|
||||
running := true
|
||||
for running {
|
||||
for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
|
||||
switch event.(type) {
|
||||
case *sdl.QuitEvent:
|
||||
println("Quit")
|
||||
running = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user