mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-26 12:01:45 +00:00
better time handling
This commit is contained in:
parent
3403886e48
commit
6e88f0f750
@ -61,11 +61,12 @@ func initGrid(width, height int, parent ...[][]Cell) ([][]Cell, error) {
|
|||||||
|
|
||||||
var grid [][]Cell
|
var grid [][]Cell
|
||||||
|
|
||||||
func setup(callback func([][]Cell), width, height, FPS int) chan bool {
|
func setup(callback func([][]Cell), width, height int, FPS time.Duration) chan bool {
|
||||||
|
// Initialize grid
|
||||||
grid, _ = initGrid(width, height)
|
grid, _ = initGrid(width, height)
|
||||||
|
|
||||||
// Prepare ticker and finishing flag
|
// Prepare ticker and finishing flag
|
||||||
ticker := time.NewTicker(time.Second / time.Duration(FPS))
|
ticker := time.NewTicker((1000 / FPS) * time.Millisecond)
|
||||||
done := make(chan bool)
|
done := make(chan bool)
|
||||||
|
|
||||||
// Run game loop
|
// Run game loop
|
||||||
|
Loading…
Reference in New Issue
Block a user