Documentation ¶
Index ¶
- type BaseJSONMessage
- type ChallengeResponseMessage
- type CombinePiecesMessage
- type DataView
- func (view DataView) Float32(offset int) float32
- func (view DataView) PutFloat32(val float32, offset int)
- func (view DataView) PutRawBytes(data []byte, offset int)
- func (view DataView) PutUint16(val uint16, offset int)
- func (view DataView) PutUint32(val uint32, offset int)
- func (view DataView) PutUint8(val uint8, offset int)
- func (view DataView) ReadString(offset int) (string, int)
- func (view DataView) Uint16(offset int) uint16
- func (view DataView) Uint32(offset int) uint32
- func (view DataView) Uint8(offset int) uint8
- type Group
- type JoinMessage
- type Message
- type MovePieceMessage
- type Options
- type PickUpPieceMessage
- type PongMessage
- type PutDownPieceMessage
- type Room
- type Session
- func (s *Session) CombinePieces(id1 uint16, id2 uint16, x float32, y float32)
- func (s *Session) Exit()
- func (s *Session) MovePiece(id uint16, x float32, y float32)
- func (s *Session) PickUpPiece(id uint16, x float32, y float32)
- func (s *Session) PutDownPiece(id uint16, x float32, y float32)
- func (s *Session) Run(ctx context.Context)
- type SessionState
- type Set
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseJSONMessage ¶
type BaseJSONMessage struct { Type string `json:"type"` Users json.RawMessage `json:"Users"` Room json.RawMessage `json:"Room"` MeID uint16 `json:"id"` Version string `json:"version"` }
type ChallengeResponseMessage ¶
type ChallengeResponseMessage struct {
Value uint32
}
func (*ChallengeResponseMessage) Encode ¶
func (m *ChallengeResponseMessage) Encode(*SessionState) (int, []byte, error)
func (*ChallengeResponseMessage) Name ¶
func (m *ChallengeResponseMessage) Name() string
type CombinePiecesMessage ¶
func (*CombinePiecesMessage) Encode ¶
func (m *CombinePiecesMessage) Encode(state *SessionState) (int, []byte, error)
func (*CombinePiecesMessage) Name ¶
func (m *CombinePiecesMessage) Name() string
type DataView ¶
type DataView []byte
DataView provides an interface to read and write different primitives from a byte array in little endian order. You must ensure that the underlying byte array has a size large enough when writing to it.
func (DataView) PutFloat32 ¶
PutFloat32 writes a float32 at the given offset.
func (DataView) PutRawBytes ¶
PutRawBytes copies the bytes from data at the given offset.
func (DataView) ReadString ¶
ReadString reads a length-prefixed string starting at the given offset. Returns the string read and the number of bytes read in total (length of string plus 2 bytes for length prefix).
type JoinMessage ¶
func (*JoinMessage) Encode ¶
func (m *JoinMessage) Encode(state *SessionState) (int, []byte, error)
func (*JoinMessage) Name ¶
func (m *JoinMessage) Name() string
type Message ¶
type Message interface { Encode(state *SessionState) (int, []byte, error) Name() string }
type MovePieceMessage ¶
func (*MovePieceMessage) Encode ¶
func (m *MovePieceMessage) Encode(state *SessionState) (int, []byte, error)
func (*MovePieceMessage) Name ¶
func (m *MovePieceMessage) Name() string
type PickUpPieceMessage ¶
func (*PickUpPieceMessage) Encode ¶
func (m *PickUpPieceMessage) Encode(state *SessionState) (int, []byte, error)
func (*PickUpPieceMessage) Name ¶
func (m *PickUpPieceMessage) Name() string
type PongMessage ¶
type PongMessage struct{}
func (*PongMessage) Encode ¶
func (m *PongMessage) Encode(state *SessionState) (int, []byte, error)
func (*PongMessage) Name ¶
func (m *PongMessage) Name() string
type PutDownPieceMessage ¶
func (*PutDownPieceMessage) Encode ¶
func (m *PutDownPieceMessage) Encode(state *SessionState) (int, []byte, error)
func (*PutDownPieceMessage) Name ¶
func (m *PutDownPieceMessage) Name() string
type Room ¶
type Room struct { BoardHeight int `json:"boardHeight"` BoardWidth int `json:"boardWidth"` Groups []Group `json:"groups"` HidePreview bool `json:"hidePreview"` Jitter float32 `json:"jitter"` Name string `json:"name"` NoLockUnlock bool `json:"noLockUnlock"` NoMultiSelect bool `json:"noMultiSelect"` Pieces uint16 `json:"pieces"` Rotation bool `json:"rotation"` Seed int `json:"seed"` StartTime int `json:"startTime"` TabSize float32 `json:"tabSize"` Sets []Set `json:"sets"` }
func (*Room) PieceHeight ¶
func (*Room) PieceWidth ¶
type Session ¶
type Session struct { OnJoined func(state *SessionState) // contains filtered or unexported fields }
func NewSession ¶
NewSession creates a new puzzle session with the given options.
func (*Session) CombinePieces ¶
type Set ¶
type Set struct { Rows uint16 `json:"rows"` Columns uint16 `json:"cols"` Width float32 `json:"width"` Height float32 `json:"height"` }
func (*Set) PieceHeight ¶
func (*Set) PieceWidth ¶
Click to show internal directories.
Click to hide internal directories.