initial commit

This commit is contained in:
filifa 2024-08-19 21:53:48 -05:00
commit 1905515311
4 changed files with 49 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
milkbucket

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module scm.dairydemon.net/filifa/milkbucket
go 1.19
require github.com/veandco/go-sdl2 v0.4.40 // indirect

2
go.sum Normal file
View File

@ -0,0 +1,2 @@
github.com/veandco/go-sdl2 v0.4.40 h1:fZv6wC3zz1Xt167P09gazawnpa0KY5LM7JAvKpX9d/U=
github.com/veandco/go-sdl2 v0.4.40/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY=

41
main.go Normal file
View File

@ -0,0 +1,41 @@
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{0, 0, 200, 200}
colour := sdl.Color{R: 255, G: 0, B: 255, A: 255} // purple
pixel := sdl.MapRGBA(surface.Format, colour.R, colour.G, colour.B, colour.A)
surface.FillRect(&rect, pixel)
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
}
}
}
}