client

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, ad *ActionDispatcher, rs *RouterStore, opt Options) error

Types

type ActionDispatcher

type ActionDispatcher struct {
	// contains filtered or unexported fields
}

ActionDispatcher is in charge of dispatching actions to the application dispatcher

func NewActionDispatcher

func NewActionDispatcher(d *flux.Dispatcher, s *store.Store, l *slog.Logger, opt Options) *ActionDispatcher

NewActionDispatcher initializes the action dispatcher with the give dispatcher

func (*ActionDispatcher) Dispatch

func (ac *ActionDispatcher) Dispatch(a *action.Action)

Dispatch is a helper to access to the internal dispatch directly with an action. This should only be used from the WS Handler to forward server actions directly

func (*ActionDispatcher) ExitWaitingRoom

func (ac *ActionDispatcher) ExitWaitingRoom(un string)

func (*ActionDispatcher) GoHome

func (ac *ActionDispatcher) GoHome()

GoHome will move the camera to the current player home line

func (*ActionDispatcher) JoinWaitingRoom

func (ac *ActionDispatcher) JoinWaitingRoom(un string)

func (*ActionDispatcher) NavigateTo

func (ac *ActionDispatcher) NavigateTo(route string)

NavigateTo navigates to the given route

func (*ActionDispatcher) SignUpSubmit

func (ac *ActionDispatcher) SignUpSubmit(un string)

func (*ActionDispatcher) WindowResizing

func (ac *ActionDispatcher) WindowResizing(w, h int)

WindowResizing new sizes of the window

type Game

type Game struct {
	Game *game.Game

	Logger *slog.Logger
}

Game is the main struct that is the initializer of the main loop. It holds all the other Stores and the Map

func NewGame added in v1.0.3

func NewGame(s *store.Store, d *flux.Dispatcher, l *slog.Logger) *Game

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) Update

func (g *Game) Update() error

type LobbyState

type LobbyState struct {
	TotalUsers int
}

type LobbyStore

type LobbyStore struct {
	*flux.ReduceStore

	Store  *Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewLobbyStore

func NewLobbyStore(d *flux.Dispatcher, s *Store, l *slog.Logger) (*LobbyStore, error)

func (*LobbyStore) Draw

func (ls *LobbyStore) Draw(screen *ebiten.Image)

func (*LobbyStore) Reduce

func (ls *LobbyStore) Reduce(state, a interface{}) interface{}

func (*LobbyStore) Update

func (ls *LobbyStore) Update() error

type Options

type Options struct {
	HostURL string
	ScreenW int
	ScreenH int
}

type RouterState

type RouterState struct {
	Route string
}

type RouterStore

type RouterStore struct {
	*flux.ReduceStore
	// contains filtered or unexported fields
}

func NewRouterStore

func NewRouterStore(d *flux.Dispatcher, su *SignUpStore, ls *LobbyStore, wr *WaitingRoomStore, g *Game, l *slog.Logger) *RouterStore

func (*RouterStore) Draw

func (rs *RouterStore) Draw(screen *ebiten.Image)

func (*RouterStore) Layout

func (rs *RouterStore) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*RouterStore) Reduce

func (rs *RouterStore) Reduce(state, a interface{}) interface{}

func (*RouterStore) Update

func (rs *RouterStore) Update() error

type SignUpState

type SignUpState struct {
	Error string
}

type SignUpStore

type SignUpStore struct {
	*flux.ReduceStore

	Store  *store.Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewSignUpStore

func NewSignUpStore(d *flux.Dispatcher, s *store.Store, l *slog.Logger) (*SignUpStore, error)

func (*SignUpStore) Draw

func (su *SignUpStore) Draw(screen *ebiten.Image)

func (*SignUpStore) Reduce

func (su *SignUpStore) Reduce(state, a interface{}) interface{}

func (*SignUpStore) Update

func (su *SignUpStore) Update() error

type Store

type Store struct {
	*store.Store

	Users *UserStore
}

func NewStore

func NewStore(ss *store.Store, us *UserStore) *Store

type UserState

type UserState struct {
	Username string
}

type UserStore

type UserStore struct {
	*flux.ReduceStore
}

func NewUserStore

func NewUserStore(d *flux.Dispatcher) *UserStore

func (*UserStore) Reduce

func (u *UserStore) Reduce(state, a interface{}) interface{}

func (*UserStore) Username

func (us *UserStore) Username() string

type WaitingRoomState

type WaitingRoomState struct {
	TotalPlayers int
	Size         int
	Countdown    int
}

type WaitingRoomStore

type WaitingRoomStore struct {
	*flux.ReduceStore

	Store  *Store
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewWaitingRoomStore

func NewWaitingRoomStore(d *flux.Dispatcher, s *Store, l *slog.Logger) *WaitingRoomStore

func (*WaitingRoomStore) Draw

func (wr *WaitingRoomStore) Draw(screen *ebiten.Image)

func (*WaitingRoomStore) Reduce

func (wr *WaitingRoomStore) Reduce(state, a interface{}) interface{}

func (*WaitingRoomStore) Update

func (wr *WaitingRoomStore) Update() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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