multiplayer

package
v0.0.0-...-fc7e386 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Players = xsync.NewMapOf[string, *Player]()

Functions

func Cleanup

func Cleanup(lobby *Lobby, id string)

@TODO cleanup the lobby from the lobbies list if players < 1

Types

type ConnectMsg

type ConnectMsg string

type DisconnectMsg

type DisconnectMsg string

type InitialReadyMsg

type InitialReadyMsg struct{}

type Lobby

type Lobby struct {
	Players    *xsync.MapOf[string, *Player]
	ID         string
	MaxPlayers int
	Ready      bool
	Game       uint
	Data       interface{}
}

func (Lobby) Broadcast

func (l Lobby) Broadcast(msg tea.Msg)

type Model

type Model struct {
	Self    *Player
	Element *list.Element
	Lobby   *Lobby
	// contains filtered or unexported fields
}

func NewModel

func NewModel(players int, game uint, initializeData initializeDataFunc) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type Player

type Player struct {
	Program *tea.Program
	Lobby   *Lobby
	ID      string
}

type SelfPlayerMsg

type SelfPlayerMsg string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL