Documentation ¶
Index ¶
- Constants
- func ToBytesUint32(n uint32) []byte
- func ToUint32Bytes(b []byte) (n uint32)
- type GameEstablished
- type GameInstance
- func (gi *GameInstance) AddPeer(s network.Stream)
- func (gi *GameInstance) Close()
- func (gi *GameInstance) IncommingMoves() <-chan interface{}
- func (gi *GameInstance) PeerCount() int
- func (gi *GameInstance) PlayersIDs() []peer.ID
- func (gi *GameInstance) RemovePeer(p peer.ID)
- func (gi *GameInstance) Run() int64
- func (gi *GameInstance) SelfID() peer.ID
- func (gi *GameInstance) SendMove(move core.Direction) (err error)
- type GameInstanceEvent
- type GameService
Constants ¶
View Source
const ID = "/snake/game/0.1.0"
Variables ¶
This section is empty.
Functions ¶
func ToBytesUint32 ¶
func ToUint32Bytes ¶
Types ¶
type GameEstablished ¶
type GameEstablished struct { Facilitator peer.ID Game *GameInstance }
type GameInstance ¶
type GameInstance struct { Seed int64 // contains filtered or unexported fields }
func NewGameInstance ¶
func NewGameInstance() *GameInstance
func (*GameInstance) AddPeer ¶
func (gi *GameInstance) AddPeer(s network.Stream)
func (*GameInstance) Close ¶
func (gi *GameInstance) Close()
func (*GameInstance) IncommingMoves ¶
func (gi *GameInstance) IncommingMoves() <-chan interface{}
func (*GameInstance) PeerCount ¶
func (gi *GameInstance) PeerCount() int
func (*GameInstance) PlayersIDs ¶
func (gi *GameInstance) PlayersIDs() []peer.ID
func (*GameInstance) RemovePeer ¶
func (gi *GameInstance) RemovePeer(p peer.ID)
func (*GameInstance) Run ¶
func (gi *GameInstance) Run() int64
func (*GameInstance) SelfID ¶
func (gi *GameInstance) SelfID() peer.ID
type GameInstanceEvent ¶
type GameInstanceEvent interface{}
type GameService ¶
type GameService struct {
// contains filtered or unexported fields
}
func NewGameService ¶
func NewGameService(h host.Host) *GameService
func (*GameService) Close ¶
func (g *GameService) Close()
func (*GameService) Disconnect ¶
func (g *GameService) Disconnect(p peer.ID)
func (*GameService) GameHandler ¶
func (g *GameService) GameHandler(s network.Stream)
func (*GameService) GetInstance ¶
func (g *GameService) GetInstance() *GameInstance
Click to show internal directories.
Click to hide internal directories.