Documentation ¶
Index ¶
- func AddTicker(imp mathf.TickerImp)
- func Exit()
- func GetOutsideSize() (int, int)
- func GetScreenSize() (int, int)
- func GetWindowSize() (int, int)
- func Height() int
- func InitGame()
- func Pop()
- func Push(scene Scene)
- func Run() error
- func SetScreenSize(w, h int)
- func SetWindowSize(w, h int)
- func Width() int
- type ContentManager
- type Dirtier
- type Disposer
- type EventHandlerOne
- type EventHandlerTwo
- type EventHandlerZero
- type EventStoreOne
- type EventStoreTwo
- type EventStoreZero
- type FSM
- type FSMTransition
- type Game
- type Scene
- type Updater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOutsideSize ¶ added in v0.2.0
func GetScreenSize ¶ added in v0.2.0
func GetWindowSize ¶ added in v0.2.0
func SetScreenSize ¶ added in v0.2.0
func SetScreenSize(w, h int)
func SetWindowSize ¶ added in v0.2.0
func SetWindowSize(w, h int)
Types ¶
type ContentManager ¶ added in v0.3.0
type ContentManager struct {
// contains filtered or unexported fields
}
ContentManager handles content loading, unloading, caching and sharing.
func NewContentManager ¶ added in v0.3.0
func NewContentManager(fsys fs.FS, rootDir string) *ContentManager
func (*ContentManager) Dispose ¶ added in v0.3.0
func (cm *ContentManager) Dispose()
func (*ContentManager) LoadFontFace ¶ added in v0.3.0
func (cm *ContentManager) LoadFontFace( font *sfnt.Font, options *opentype.FaceOptions, ) (font.Face, error)
LoadFontFace will load a font face from font and options. Note that no caching is done for this, so only load once per unique font and options.
func (*ContentManager) LoadImage ¶ added in v0.3.0
func (cm *ContentManager) LoadImage(path string) (*ebiten.Image, error)
func (*ContentManager) LoadOpenType ¶ added in v0.3.0
func (cm *ContentManager) LoadOpenType(path string) (*sfnt.Font, error)
type Dirtier ¶
type Dirtier interface { // IsDirty returns whether or not our object is dirty IsDirty() bool // Clean the object back to a fresh state Clean() }
Dirtier allows structs to track when they are changed and only apply complex changes when there is something new to update.
type Disposer ¶ added in v0.2.0
type Disposer interface {
Dispose()
}
Disposer lets content be disposed of properly
type EventHandlerOne ¶ added in v0.3.0
type EventHandlerOne[T any] func(T)
EventHandlerOne handles events with one argument
type EventHandlerTwo ¶ added in v0.3.0
type EventHandlerTwo[T0, T1 any] func(T0, T1)
EventHandlerTwo handles events with two arguments
type EventHandlerZero ¶ added in v0.3.0
type EventHandlerZero func()
EventHandlerZero handles events with no arguments
type EventStoreOne ¶ added in v0.3.0
type EventStoreOne[T any] struct { // contains filtered or unexported fields }
EventStoreOne contains all the events we are subscribed to with one argument
func (*EventStoreOne[T]) Publish ¶ added in v0.3.0
func (e *EventStoreOne[T]) Publish(value T)
Publish an event to all subscribers
func (*EventStoreOne[T]) Subscribe ¶ added in v0.3.0
func (e *EventStoreOne[T]) Subscribe(fn EventHandlerOne[T])
Subscribe to our event
type EventStoreTwo ¶ added in v0.3.0
type EventStoreTwo[T0, T1 any] struct { // contains filtered or unexported fields }
EventStoreTwo contains all the events we are subscribed to with two arguments
func (*EventStoreTwo[T0, T1]) Publish ¶ added in v0.3.0
func (e *EventStoreTwo[T0, T1]) Publish(t0 T0, t1 T1)
Publish an event to all subscribers
func (*EventStoreTwo[T0, T1]) Subscribe ¶ added in v0.3.0
func (e *EventStoreTwo[T0, T1]) Subscribe(fn EventHandlerTwo[T0, T1])
Subscribe to our event
type EventStoreZero ¶ added in v0.3.0
type EventStoreZero struct {
// contains filtered or unexported fields
}
EventStoreZero contains all the events we are subscribed to with no arguments
func (*EventStoreZero) Publish ¶ added in v0.3.0
func (e *EventStoreZero) Publish()
Publish an event to all subscribers
func (*EventStoreZero) Subscribe ¶ added in v0.3.0
func (e *EventStoreZero) Subscribe(fn EventHandlerZero)
Subscribe to our event
type FSM ¶ added in v0.3.0
type FSM[T ~string] struct { // contains filtered or unexported fields }
FSM is a mini finite state machine
func NewFSM ¶ added in v0.3.0
func NewFSM[T ~string](startingValue T, transitions ...FSMTransition[T]) *FSM[T]
NewWatchable will create a watchable with a starting value
func (*FSM[T]) CanTransition ¶ added in v0.3.0
func (*FSM[T]) OnTransition ¶ added in v0.3.0
func (fsm *FSM[T]) OnTransition(state T, handler EventHandlerZero)
func (*FSM[T]) Transition ¶ added in v0.3.0
Transition to a new state will return true if we were able to transition, otherwise false
type FSMTransition ¶ added in v0.3.0
type FSMTransition[T ~string] struct { From T To []T }
func NewFSMTransition ¶ added in v0.3.0
func NewFSMTransition[T ~string](from T, to ...T) FSMTransition[T]
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
func (*Game) Draw ¶ added in v0.2.0
func (g *Game) Draw(dest *ebiten.Image)
Draw all the game scenes, bottom up