engine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(value, min, max float64) float64

func CubicEaseIn

func CubicEaseIn(t float64) float64

Cubic ease in - even more pronounced slow start

func CubicEaseOut

func CubicEaseOut(t float64) float64

Cubic ease out - even more pronounced slow end

func EaseIn

func EaseIn(t float64) float64

Ease in - starts slow, ends fast

func EaseInOut

func EaseInOut(t float64) float64

Ease in-out - slow at both ends, smooth in middle

func EaseOut

func EaseOut(t float64) float64

Ease out - starts fast, ends slow

func FindChildrenWithComponent

func FindChildrenWithComponent(e *donburi.Entry, c component.IComponentType) []*donburi.Entry

func FindWithComponent

func FindWithComponent(w donburi.World, componentType component.IComponentType) (*donburi.Entry, bool)

func IntPercent

func IntPercent(value int, percent float64) int

func Lerp

func Lerp(a, b, t float64) float64

func LerpVec2

func LerpVec2(a, b math.Vec2, t float64) math.Vec2

func MustFindChildWithComponent

func MustFindChildWithComponent(parent *donburi.Entry, componentType component.IComponentType) *donburi.Entry

func MustFindComponent

func MustFindComponent[T any](w donburi.World, c Component[T]) *T

func MustFindGrandchildWithComponent

func MustFindGrandchildWithComponent(parent *donburi.Entry, componentType component.IComponentType) *donburi.Entry

func MustFindWithComponent

func MustFindWithComponent(w donburi.World, componentType component.IComponentType) *donburi.Entry

func MustGetParent

func MustGetParent(entry *donburi.Entry) *donburi.Entry

func RandomFloatRange

func RandomFloatRange(min, max float64) float64

func RandomFrom

func RandomFrom[T comparable](list []T) T

func RandomFromOrEmpty

func RandomFromOrEmpty[T comparable](list []T) *T

func RandomIntRange

func RandomIntRange(min, max int) int

Types

type Component

type Component[T any] interface {
	donburi.IComponentType
	Get(entry *donburi.Entry) *T
}

type DurationRange

type DurationRange struct {
	Min time.Duration
	Max time.Duration
}

func (DurationRange) Random

func (r DurationRange) Random() time.Duration

type FloatRange

type FloatRange struct {
	Min float64
	Max float64
}

func (FloatRange) Random

func (r FloatRange) Random() float64

type IntRange

type IntRange struct {
	Min int
	Max int
}

func (IntRange) Random

func (r IntRange) Random() int

type Rect

type Rect struct {
	X      float64
	Y      float64
	Width  float64
	Height float64
}

func NewRect

func NewRect(x, y, width, height float64) Rect

func (Rect) Intersects

func (r Rect) Intersects(other Rect) bool

func (Rect) MaxX

func (r Rect) MaxX() float64

func (Rect) MaxY

func (r Rect) MaxY() float64

func (Rect) Move

func (r Rect) Move(pos math.Vec2) Rect

func (Rect) Position

func (r Rect) Position() math.Vec2

func (Rect) Scale

func (r Rect) Scale(scale float64) Rect

func (Rect) Size

func (r Rect) Size() Size

func (Rect) ToImageRectangle

func (r Rect) ToImageRectangle() image.Rectangle

type Size

type Size struct {
	Width  int
	Height int
}

type Timer

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

func NewTimer

func NewTimer(d time.Duration) *Timer

func (*Timer) CurrentFrames

func (t *Timer) CurrentFrames() int

func (*Timer) Finish

func (t *Timer) Finish()

func (*Timer) IsReady

func (t *Timer) IsReady() bool

func (*Timer) IsStarted

func (t *Timer) IsStarted() bool

func (*Timer) PercentDone

func (t *Timer) PercentDone() float64

func (*Timer) Reset

func (t *Timer) Reset()

func (*Timer) SetTarget

func (t *Timer) SetTarget(target time.Duration)

func (*Timer) TargetFrames

func (t *Timer) TargetFrames() int

func (*Timer) Update

func (t *Timer) Update()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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