states

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DifficultyHard   Difficulty = "hard"
	DifficultyNormal            = "normal"
	DifficultyEasy              = "easy"
)

Variables

View Source
var (
	ErrQuitGame = errors.New("quit game")
)

Functions

This section is empty.

Types

type Context

type Context struct {
	StateMachine StateMachine
	Cursor       Cursor
	MusicPlayer  MusicPlayer
	Difficulty   Difficulty
	R            Resource
	L            Localizer
}

type Cursor

type Cursor interface {
	Enabled() bool
	Enable()
	Disable()
}

type Difficulty

type Difficulty string

type DrawContext

type DrawContext struct {
	Screen *ebiten.Image
	Text   *etxt.Renderer
	R      Resource
	L      Localizer
}

type GPT

type GPT interface {
	GetKey() string
	SetKey() string
	CheckKey() bool
	GetStyle() string
	SetStyle() string
}

type Localizer

type Localizer interface {
	SetGPTStyle(style string)
	GetGPTStyle() string
	SetGPTKey(key string)
	GetGPTKey() string
	CheckGPTKey() bool
	GPTIsActive() bool
	InitGPT()
	Locale() string
	SetLocale(loc string, gpt bool)
	Get(key string) string
}

type MusicPlayer

type MusicPlayer interface {
	Play(s Song) error
	Resume()
	Pause()
	Loop() bool
	SetLoop(loop bool)
	Volume() float64
	SetVolume(volume float64)
}

type Resource

type Resource interface {
	Get(category string, name string) interface{}
	GetAs(category string, name string, target interface{}) interface{}
	GetNamesWithPrefix(category string, prefix string) []string
}

type Song

type Song interface {
	Stream() *vorbis.Stream
}

type State

type State interface {
	Init(ctx Context) error
	Finalize(ctx Context) error
	Enter(ctx Context, v interface{}) error
	Update(ctx Context) error
	Draw(ctx DrawContext)
}

type StateMachine

type StateMachine interface {
	PushState(state State)
	PopState(v interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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