Closed SiirRandall closed 2 years ago
Hi @SiirRandall! Does the program eventually exit (should be after around 2 seconds)? If so, I believe it has something to do with the program not having an event loop. I have updated the example to have it on the master
branch. Could you try again and see if that helps?
No, it doesn't exit at all. It will continue running until I break it.
Hi @SiirRandall, could you try to build the program shown in README.md using go build
? I wonder if it takes a long time to finish compiling the first time on the Raspberry Pi. If the program can be built and it still runs indefinitely, could you try reducing the Go code as much as you can and re-build it until it works? Perhaps we can find the cause that way.
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}
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
}
}
}
}
It is working after the build. It took around 4-5 min to build. My apologies for creating this issue. I feel pretty stupid right now.
Edit: And it does compile instantly after the first time. I would also like to apologize for wasting your time.
Thank goodness! It's not a waste of time. Perhaps I should add this information to the README.
Glad I could help. I will go ahead and close this. Again thank you again for your help.
So I build the latest SDL2 with RPI Video support to use this in framebuffer mode. Everything else seems to run fine for SDL2. When I try to run any examples or even try to build it just stays and the prompt with no warnings or errors.
`pi@raspberrypi:~/go-sdl2-examples/examples/texture $ go run texture.go
I installed the mod with
go get -v github.com/veandco/go-sdl2/sdl@master`I am not sure what to include in this issue report as it's not giving me any warnings or errors. It could be something else not related to this project. But everything else works fine with SDL2. I even tested C++ using the SDL2 libs and a simple SDL2 test, That worked fine. I am pretty sure this is me messing up something, but I am out of ideas. If it is a bug I will provide anything you need from me.