Documentation ¶
Index ¶
- type BoardColor
- type ChessPiecesColor
- type Game
- func (g *Game) AddSession(s *Session)
- func (g *Game) CheckGameState()
- func (g *Game) RemoveSession(s *Session, msg string)
- func (g *Game) Render(s *Session)
- func (g *Game) Run()
- func (g *Game) SessionCount() int
- func (g *Game) SetBoardColorsSelectingPiece(playerPosition Position, chessPiecesColor ChessPiecesColor)
- func (g *Game) SetPositionColor(playerPosition Position, boardColor BoardColor)
- func (g *Game) SwitchPlayersIsActive()
- func (g *Game) Update(delta float64)
- func (g *Game) WorldHeight() int
- func (g *Game) WorldWidth() int
- type GameManager
- type Hub
- type KeyState
- type Player
- type PlayerState
- type Position
- type Session
- type UnregisterMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChessPiecesColor ¶
type ChessPiecesColor int
const ( White ChessPiecesColor = iota Black )
func (ChessPiecesColor) String ¶
func (c ChessPiecesColor) String() string
type Game ¶
type Game struct { Name string Redraw chan struct{} Model *chess.Game // contains filtered or unexported fields }
func NewUserCreatedGame ¶
func (*Game) AddSession ¶
func (*Game) CheckGameState ¶
func (g *Game) CheckGameState()
func (*Game) RemoveSession ¶
func (*Game) SessionCount ¶
func (*Game) SetBoardColorsSelectingPiece ¶
func (g *Game) SetBoardColorsSelectingPiece(playerPosition Position, chessPiecesColor ChessPiecesColor)
func (*Game) SetPositionColor ¶
func (g *Game) SetPositionColor(playerPosition Position, boardColor BoardColor)
func (*Game) SwitchPlayersIsActive ¶
func (g *Game) SwitchPlayersIsActive()
func (*Game) Update ¶
Update is the main game logic loop. Delta is the time since the last update in milliseconds.
func (*Game) WorldHeight ¶
func (*Game) WorldWidth ¶
type GameManager ¶
type GameManager struct { UserCreatedGames map[string]*Game Games map[string]*Game HandleChannel chan ssh.Channel // contains filtered or unexported fields }
func NewGameManager ¶
func NewGameManager(logger logger.Logger) *GameManager
func (*GameManager) GameCount ¶
func (gm *GameManager) GameCount() int
func (*GameManager) HandleNewChannel ¶
func (gm *GameManager) HandleNewChannel(c ssh.Channel, user string)
func (*GameManager) SessionCount ¶
func (gm *GameManager) SessionCount() int
type Hub ¶
type Hub struct { Sessions map[*Session]struct{} Redraw chan struct{} Register chan *Session Unregister chan UnregisterMessage }
type Player ¶
type Player struct { Name string CreatedAt time.Time BoardPosition *Position IsActive bool PlayerColor ChessPiecesColor PlayerState PlayerState SelectedPiecePosition *Position TakenPiecesList []string // contains filtered or unexported fields }
func (*Player) HandleAction ¶
func (p *Player) HandleAction()
func (*Player) HandleDown ¶
func (p *Player) HandleDown()
func (*Player) HandleLeft ¶
func (p *Player) HandleLeft()
func (*Player) HandleRight ¶
func (p *Player) HandleRight()
func (*Player) SetIsActive ¶
type Session ¶
type Session struct { LastAction time.Time HighScore int Player *Player // contains filtered or unexported fields }
func NewSession ¶
type UnregisterMessage ¶
type UnregisterMessage struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.