Exemplo n.º 1
0
func main() {
	if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
		panic(sdl.GetError())
	}

	defer sdl.Quit()

	screen := sdl.SetVideoMode(640, 480, 32, sdl.SWSURFACE)
	if screen == nil {
		panic(sdl.GetError())
	}

	sdl.WM_SetCaption("Hello World", "test.png")

	message := load_image("hello.bmp")
	background := load_image("background.bmp")

	apply_surface(0, 0, background, screen)
	apply_surface(320, 0, background, screen)
	apply_surface(0, 240, background, screen)
	apply_surface(320, 240, background, screen)

	apply_surface(180, 140, message, screen)

	message.Free()
	background.Free()

	screen.Flip()
	sdl.Delay(2000)

}
Exemplo n.º 2
0
func main() {
	if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
		panic(sdl.GetError())
	}

	defer sdl.Quit()

	screen := sdl.SetVideoMode(640, 480, 32, sdl.SWSURFACE)
	if screen == nil {
		panic(sdl.GetError())
	}

	hello := sdl.Load("hello.bmp")

	screen.Blit(nil, hello, nil)
	screen.Flip()

	sdl.Delay(2000)
	hello.Free()
}