Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoValueByKey = errors.New("no value by key in storage")
Functions ¶
func BorderTable ¶
Types ¶
type DummyHandler ¶
type DummyHandler struct{}
func (DummyHandler) AnimationRequest ¶
func (DummyHandler) AnimationRequest(tiles []*Tile)
func (DummyHandler) Init ¶
func (DummyHandler) Init(size Point)
func (DummyHandler) Message ¶
func (DummyHandler) Message(MessageKind)
func (DummyHandler) UpdateBestScore ¶
func (DummyHandler) UpdateBestScore(bestScore int)
func (DummyHandler) UpdateScore ¶
func (DummyHandler) UpdateScore(score int)
type GameManager ¶
type GameManager struct {
// contains filtered or unexported fields
}
func NewGameManager ¶
func NewGameManager(storage Storage, handler Handler) *GameManager
func (*GameManager) Draw ¶
func (gm *GameManager) Draw()
func (*GameManager) KeepPlaying ¶
func (gm *GameManager) KeepPlaying()
Keep playing after winning (allows going over 2048)
func (*GameManager) Move ¶
func (gm *GameManager) Move(d Direction)
Move tiles on the grid in the specified direction
func (*GameManager) PrintableGrid ¶
func (gm *GameManager) PrintableGrid() []byte
func (*GameManager) UndoMove ¶
func (gm *GameManager) UndoMove()
type Handler ¶
type Handler interface { Init(size Point) AnimationRequest(tiles []*Tile) UpdateScore(score int) UpdateBestScore(bestScore int) Message(MessageKind) }
type InputManager ¶
type InputManager interface { Restart() KeepPlaying() Move(d Direction) UndoMove() Draw() }
type MapStorage ¶
func NewMapStorage ¶
func NewMapStorage() *MapStorage
func (*MapStorage) Remove ¶
func (ms *MapStorage) Remove(key string) error
type MessageKind ¶
type MessageKind int
const ( MK_CLEAR MessageKind = iota // Clear the game won/lost message MK_YOU_LOSE // You lose MK_YOU_WIN // You win! )
func (MessageKind) String ¶
func (mk MessageKind) String() string
type Point ¶
func DefaultSize ¶
func DefaultSize() Point
type StorageManager ¶
type StorageManager struct {
// contains filtered or unexported fields
}
func NewStorageManager ¶
func NewStorageManager(storage Storage) *StorageManager
Click to show internal directories.
Click to hide internal directories.