reorganize

This commit is contained in:
2019-11-01 18:21:27 +03:00
parent 1ac6ae4665
commit 529f5a5749
7 changed files with 56 additions and 49 deletions

View File

@ -0,0 +1,27 @@
package gamestate
import (
"lab.zaar.be/thefish/alchemyst-go/engine/gamemap"
"lab.zaar.be/thefish/alchemyst-go/engine/mob"
)
type GameState struct {
Mainfunc chan func()
Exit chan struct{}
Input chan string
RawInput chan int
FovRecompute chan struct{}
Redraw chan struct{}
Level *gamemap.Level
Player *mob.Player
}
// do runs f on the main thread.
func (g *GameState) Do(f func()) {
done := make(chan struct{}, 1)
g.Mainfunc <- func() {
f()
done <- struct{}{}
}
<-done
}