igloo

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 10 Imported by: 3

README

Igloo

PkgGoDev codecov GitHub Workflow Status

Extension framework to ebiten

Very much in progress and not production ready

Examples

Coming soon, the go package docs is probably the easiest to read for now.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTicker added in v0.3.0

func AddTicker(imp mathf.TickerImp)

func Exit added in v0.2.0

func Exit()

Exit the game at the end of the next update

func GetOutsideSize added in v0.2.0

func GetOutsideSize() (int, int)

func GetScreenSize added in v0.2.0

func GetScreenSize() (int, int)

func GetWindowSize added in v0.2.0

func GetWindowSize() (int, int)

func Height added in v0.2.0

func Height() int

func InitGame added in v0.2.0

func InitGame()

func Pop added in v0.2.0

func Pop()

Pop a scene off the stack

func Push added in v0.2.0

func Push(scene Scene)

Push a new scene to the top of the stack

func Run added in v0.2.0

func Run() error

func SetScreenSize added in v0.2.0

func SetScreenSize(w, h int)

func SetWindowSize added in v0.2.0

func SetWindowSize(w, h int)

func Width added in v0.2.0

func Width() 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 *FSM[T]) CanTransition(value T) bool

func (*FSM[T]) Current added in v0.3.0

func (fsm *FSM[T]) Current() T

func (*FSM[T]) Last added in v0.3.0

func (fsm *FSM[T]) Last() T

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

func (fsm *FSM[T]) Transition(value T) bool

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

func (*Game) Layout added in v0.2.0

func (g *Game) Layout(outsideWidth int, outsideHeight int) (int, int)

func (*Game) Update added in v0.2.0

func (g *Game) Update() error

Update the top scene of the stack

type Scene

type Scene interface {
	Updater
	Disposer

	// Draw all game elements.
	Draw(screen *ebiten.Image)
}

Scene is a core component of logic and rendering. The core methods are update and draw to handle game logic and rendering.

type Updater added in v0.2.0

type Updater interface {
	Update(*mathf.GameTime)
}

Updater is the default updating method

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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