remove fps counters from examples for simplicity and consistency
This commit is contained in:
parent
2626892e97
commit
1d0169b2b7
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"image"
|
"image"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
|
@ -144,11 +143,7 @@ func run() {
|
||||||
oneLight := pixelgl.NewCanvas(win.Bounds())
|
oneLight := pixelgl.NewCanvas(win.Bounds())
|
||||||
allLight := pixelgl.NewCanvas(win.Bounds())
|
allLight := pixelgl.NewCanvas(win.Bounds())
|
||||||
|
|
||||||
var (
|
fps30 := time.Tick(time.Second / 30)
|
||||||
frames = 0
|
|
||||||
second = time.Tick(time.Second)
|
|
||||||
fps30 = time.Tick(time.Second / 30)
|
|
||||||
)
|
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
for !win.Closed() {
|
for !win.Closed() {
|
||||||
|
@ -198,13 +193,6 @@ func run() {
|
||||||
win.Update()
|
win.Update()
|
||||||
|
|
||||||
<-fps30 // maintain 30 fps, because my computer couldn't handle 60 here
|
<-fps30 // maintain 30 fps, because my computer couldn't handle 60 here
|
||||||
frames++
|
|
||||||
select {
|
|
||||||
case <-second:
|
|
||||||
win.SetTitle(fmt.Sprintf("%s | FPS: %d", cfg.Title, frames))
|
|
||||||
frames = 0
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"container/list"
|
"container/list"
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"fmt"
|
|
||||||
"image"
|
"image"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
@ -204,11 +203,6 @@ func run() {
|
||||||
|
|
||||||
batch := pixel.NewBatch(&pixel.TrianglesData{}, sheet)
|
batch := pixel.NewBatch(&pixel.TrianglesData{}, sheet)
|
||||||
|
|
||||||
var (
|
|
||||||
second = time.Tick(time.Second)
|
|
||||||
frames = 0
|
|
||||||
)
|
|
||||||
|
|
||||||
last := time.Now()
|
last := time.Now()
|
||||||
for !win.Closed() {
|
for !win.Closed() {
|
||||||
dt := time.Since(last).Seconds()
|
dt := time.Since(last).Seconds()
|
||||||
|
@ -224,14 +218,6 @@ func run() {
|
||||||
batch.Draw(win)
|
batch.Draw(win)
|
||||||
|
|
||||||
win.Update()
|
win.Update()
|
||||||
|
|
||||||
frames++
|
|
||||||
select {
|
|
||||||
case <-second:
|
|
||||||
win.SetTitle(fmt.Sprintf("%s | FPS: %d", cfg.Title, frames))
|
|
||||||
frames = 0
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue