timestep

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InterpCallback

type InterpCallback func(alpha float64)

InterpCallback is called whenever the timestep has overstepped the actual time and linear interpolation needs to be performed.

type Segmenter

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

Segmenter is a mechanism to get reliable fixed-interval ticks, sincefor some algorithms (like physics) having consistent intervals is a necessity.

func NewSegmenter

func NewSegmenter(interval time.Duration) *Segmenter

NewSegmenter creates a new Segmenter that produces the specified fixed-interval updates.

func (*Segmenter) Update

func (t *Segmenter) Update(delta time.Duration, fixedCallback UpdateCallback, interpCallback InterpCallback)

Update should be called with the actual delta time elapsed. The callback function will be called a number of times with fixed delta intervals.

type UpdateCallback

type UpdateCallback func(elapsedTime time.Duration)

UpdateCallback is a mechanism to receive delta time increments.

type UpdateSubscription

type UpdateSubscription = observer.Subscription[UpdateCallback]

UpdateSubscription represents a notification subscription for updates.

type UpdateSubscriptionSet added in v0.18.0

type UpdateSubscriptionSet = observer.SubscriptionSet[UpdateCallback]

UpdateSubscriptionSet represents a set of update subscriptions.

func NewUpdateSubscriptionSet added in v0.18.0

func NewUpdateSubscriptionSet() *UpdateSubscriptionSet

NewUpdateSubscriptionSet creates a new UpdateSubscriptionSet.

Jump to

Keyboard shortcuts

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