Example #1
0
func update(screen *ebiten.Image) error {
	world.Progress()
	world.DrawImage(noiseImage)
	if err := screen.ReplacePixels(noiseImage.Pix); err != nil {
		return err
	}
	return nil
}
Example #2
0
func update(screen *ebiten.Image) error {
	const l = screenWidth * screenHeight
	for i := 0; i < l; i++ {
		x := randInstance.next()
		noiseImage.Pix[4*i] = uint8(x >> 24)
		noiseImage.Pix[4*i+1] = uint8(x >> 16)
		noiseImage.Pix[4*i+2] = uint8(x >> 8)
		noiseImage.Pix[4*i+3] = 0xff
	}
	if err := screen.ReplacePixels(noiseImage.Pix); err != nil {
		return err
	}
	if err := ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %f", ebiten.CurrentFPS())); err != nil {
		return err
	}
	return nil
}