states

package
v0.0.0-...-d5d5497 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToFloat64

func ToFloat64(a int, b int) (float64, float64)

Types

type Connect

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

Connect is a state that manages and watches a connection to a morogue server. It should be noted that this doesn't sit in the state machine, but rather runs directly in the app struct. FIXME: At the moment, this doesn't handle reconnection and all that. What it should do is when a connection is lost, to pop the entire state machine, then attempt to connect and push the login state upon success.

func (*Connect) Begin

func (state *Connect) Begin(ctx ifs.RunContext) error

func (*Connect) Draw

func (state *Connect) Draw(ctx ifs.DrawContext)

func (*Connect) End

func (state *Connect) End() (interface{}, error)

func (*Connect) Leave

func (state *Connect) Leave() error

func (*Connect) Return

func (state *Connect) Return(interface{}) error

func (*Connect) Update

func (state *Connect) Update(ctx ifs.RunContext) error

type Create

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

Create is a rather massive and messy state that controls character selection, creation, and deletion. Popping Create should return to the Login state.

func NewCreate

func NewCreate(connection net.Connection, msgCh chan net.Message) *Create

NewCreate creates a new Create instance.

func (*Create) Begin

func (state *Create) Begin(ctx ifs.RunContext) error

func (*Create) Draw

func (state *Create) Draw(ctx ifs.DrawContext)

func (*Create) End

func (state *Create) End() (interface{}, error)

func (*Create) Leave

func (state *Create) Leave() error

func (*Create) Return

func (state *Create) Return(interface{}) error

func (*Create) Update

func (state *Create) Update(ctx ifs.RunContext) error

type Data

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

func NewData

func NewData() *Data

func (*Data) Archetype

func (d *Data) Archetype(id id.UUID) game.Archetype

func (*Data) ArchetypeImage

func (d *Data) ArchetypeImage(id id.UUID) *ebiten.Image

func (*Data) EnsureImage

func (d *Data) EnsureImage(archetype game.Archetype, zoom float64) (*ebiten.Image, error)

func (*Data) LoadImage

func (d *Data) LoadImage(src string, scale float64) (*ebiten.Image, error)

type Game

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

Game represents the running game in the world.

func NewGame

func NewGame(connection net.Connection, msgCh chan net.Message, data *Data) *Game

NewGame creates a new Game instance.

func (*Game) Begin

func (state *Game) Begin(ctx ifs.RunContext) error

func (*Game) Character

func (state *Game) Character() *game.Character

func (*Game) Draw

func (state *Game) Draw(ctx ifs.DrawContext)

func (*Game) End

func (state *Game) End() (interface{}, error)

func (*Game) Leave

func (state *Game) Leave() error

func (*Game) Return

func (state *Game) Return(interface{}) error

func (*Game) Update

func (state *Game) Update(ctx ifs.RunContext) error

type Login

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

Login is the first state when connecting to a server. It provides the ability to login or register an account with the server.

func NewLogin

func NewLogin(connection net.Connection, msgCh chan net.Message) *Login

NewLogin creates a new Login instance.

func (*Login) Begin

func (state *Login) Begin(ctx ifs.RunContext) error

func (*Login) Draw

func (state *Login) Draw(ctx ifs.DrawContext)

func (*Login) End

func (state *Login) End() (interface{}, error)

func (*Login) Leave

func (state *Login) Leave() error

func (*Login) Return

func (state *Login) Return(interface{}) error

func (*Login) Update

func (state *Login) Update(ctx ifs.RunContext) error

type Worlds

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

Worlds is the state for joining and creating worlds. It displays a list of worlds acquired from net.WorldsMessage and has a section for specifying world options and thereafter sending a net.CreateWorldMessage. Popping Worlds should return to the Create state.

func NewWorlds

func NewWorlds(connection net.Connection, msgCh chan net.Message, data *Data) *Worlds

NewWorlds creates a new Worlds instance.

func (*Worlds) Begin

func (state *Worlds) Begin(ctx ifs.RunContext) error

func (*Worlds) Draw

func (state *Worlds) Draw(ctx ifs.DrawContext)

func (*Worlds) End

func (state *Worlds) End() (interface{}, error)

func (*Worlds) Leave

func (state *Worlds) Leave() error

func (*Worlds) Return

func (state *Worlds) Return(interface{}) error

func (*Worlds) Update

func (state *Worlds) Update(ctx ifs.RunContext) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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