Пример #1
0
func initApp() App {
	sdl.Run(640, 480)
	sdl.SetFrame(sdl.NewSurface(320, 240))

	a := &app{}
	a.nanosecondsPerFrame = 33e6
	a.states = []State{}

	return a
}
Пример #2
0
func BenchmarkTruecolorBlit(b *testing.B) {
	b.StopTimer()
	sdl.Run(320, 240)
	defer sdl.Stop()
	surf := unpaletted()
	b.StartTimer()
	for i := 0; i < b.N; i++ {
		for y := 0; y < 30; y++ {
			for x := 0; x < 40; x++ {
				surf.Blit(surf.Bounds(), x*8, y*8, sdl.Frame())
			}
		}
		sdl.Flip()
	}
	b.StopTimer()
}