Documentation ¶
Index ¶
- type Game
- func (game *Game) AddScore(baseScore uint64, levelBoost bool)
- func (game *Game) Changed()
- func (game *Game) Drop()
- func (game *Game) GetGrid() GameGrid
- func (game *Game) Iterate() bool
- func (game *Game) Lockdown() bool
- func (game *Game) MoveDown() bool
- func (game *Game) MoveX(d int32) bool
- func (game *Game) NextTetromino()
- func (game *Game) Rotate(d int8)
- func (game *Game) SetKey(event map[string]interface{})
- func (game *Game) SetKeyStates(kss *map[string]interface{})
- type GameGrid
- type Sprite
- type Tetromino
- type TetrominoFactory
- type Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Game ¶
type Game struct { // Five position array of tetrominoes, where index // 0: Current dropping tetromino // 1: Coming up 1 // 2: Coming up 2 // 3: Coming up 3 // -- 4: On hold (TODO) Tetrominoes [5]Tetromino // Base offset of dropping tetromino // Can be outside of grid if current tetromino sprite has blank rows/columns Position Vector GhostPosition Vector // Rotation of dropping tetromino // Should be >0 and <4 Rotation int8 Score uint64 Level uint64 Lines uint64 // Internal stuff below Nickname string // contains filtered or unexported fields }
Game --------------------------------------------------------------------------------------------
func (*Game) NextTetromino ¶
func (game *Game) NextTetromino()
func (*Game) SetKeyStates ¶
type GameGrid ¶
type GameGrid struct { // Standard tetris game field is 10 units wide and 22 units high, with the topmost 2 rows hidden Data [10 * 22]rune }
Grid --------------------------------------------------------------------------------------------
type TetrominoFactory ¶
type TetrominoFactory struct {
Inventory []Tetromino
}
func NewTetrominoFactory ¶
func NewTetrominoFactory() TetrominoFactory
func (*TetrominoFactory) Next ¶
func (tf *TetrominoFactory) Next() Tetromino
Click to show internal directories.
Click to hide internal directories.