reorganize
This commit is contained in:
27
engine/gamestate/gamestate.go
Normal file
27
engine/gamestate/gamestate.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user