sdl2-life

Conway's Game of Life with go-sdl2
git clone https://www.brianlane.com/git/sdl2-life
Log | Files | Refs | README

commit f8ce323eeb851161d967c2db65a7b8678375da20
parent 395bd3416d29b31883392fc688b9af6b5092eecd
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Tue, 26 Nov 2019 19:30:09 -0800

Add a small delay to lower CPU usage

Diffstat:
Mmain.go | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/main.go b/main.go @@ -319,6 +319,8 @@ func (g *LifeGame) Run() { } } } + // Delay a small amount + time.Sleep(1 * time.Millisecond) if sdl.GetTicks() > fpsTime+(1000/fps) { g.NextFrame() fpsTime = sdl.GetTicks()