Comments
This commit is contained in:
parent
44724cbbb6
commit
c2134de4b7
8
main.go
8
main.go
@ -6,17 +6,23 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
// Create a channel to push key-presses through
|
// Create channles to manage keypresses and the gamestate
|
||||||
keypresses := make(chan int)
|
keypresses := make(chan int)
|
||||||
gamestate := make(chan int)
|
gamestate := make(chan int)
|
||||||
|
|
||||||
|
// Initialize tcell and clean up when needed.
|
||||||
screen, style, err := initilize()
|
screen, style, err := initilize()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln("Initlization error: ", err)
|
log.Fatalln("Initlization error: ", err)
|
||||||
}
|
}
|
||||||
defer quit(screen)
|
defer quit(screen)
|
||||||
|
|
||||||
|
// Spawn the Game Director in its own go routine
|
||||||
|
// We give it channels to control...
|
||||||
go gameDirector(screen, style, keypresses, gamestate)
|
go gameDirector(screen, style, keypresses, gamestate)
|
||||||
|
|
||||||
|
// A simple function that captures keyboard presses...
|
||||||
|
// ...and sends it to the GameDirector.
|
||||||
keyboardProcessor(screen, keypresses, gamestate)
|
keyboardProcessor(screen, keypresses, gamestate)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user