types.go 504 B

123456789101112131415161718192021222324252627282930313233
  1. package game
  2. import "github.com/gdamore/tcell/v3"
  3. // Directions for movement and actions
  4. const (
  5. up = iota
  6. Left
  7. right
  8. down
  9. upleft
  10. upright
  11. downleft
  12. downright
  13. action
  14. )
  15. // Styles holds the different styles for the game elements
  16. type Styles struct {
  17. Default tcell.Style
  18. ship tcell.Style
  19. hit tcell.Style
  20. miss tcell.Style
  21. sea tcell.Style
  22. }
  23. // Game holds the state of the game
  24. type Game struct {
  25. screen tcell.Screen
  26. style Styles
  27. keypresses chan int
  28. score int
  29. }