main.go 627 B

12345678910111213141516171819202122232425262728
  1. package main
  2. import (
  3. "log"
  4. )
  5. func main() {
  6. // Create channles to manage keypresses and the gamestate
  7. keypresses := make(chan int)
  8. gamestate := make(chan int)
  9. // Initialize tcell and clean up when needed.
  10. screen, style, err := initilize()
  11. if err != nil {
  12. log.Fatalln("Initlization error: ", err)
  13. }
  14. defer quit(screen)
  15. // Spawn the Game Director in its own go routine
  16. // We give it channels to control...
  17. go gameDirector(screen, style, keypresses, gamestate)
  18. // A simple function that captures keyboard presses...
  19. // ...and sends it to the GameDirector.
  20. keyboardProcessor(screen, keypresses, gamestate)
  21. }