Beispiel #1
0
func InitSplash(system *twodee.System, window *twodee.Window, frame int) (splash *Splash, err error) {
	if system.LoadTexture("splash", "assets/splash-fw.png", twodee.IntNearest, 0); err != nil {
		return
	}
	splash = &Splash{
		running: true,
		window:  window,
		system:  system,
		scene:   &twodee.Scene{},
	}
	system.SetKeyCallback(func(k, s int) {
		threshold := time.Duration(500) * time.Millisecond
		if time.Now().After(splash.started.Add(threshold)) {
			splash.running = false
		}
	})
	fmt.Println(system.Textures)
	splash.sprite = system.NewSprite("splash", 0, 0, int(window.View.Dx()), int(window.View.Dy()), 0)
	splash.sprite.SetFrame(frame)
	splash.scene.AddChild(splash.sprite)
	splash.started = time.Now()
	return
}