Documentation ¶
Index ¶
- Variables
- func ApplyComponentTransforms(tr Transformer, geom *ebiten.GeoM)
- func ApplyTransform(transform *Transform, geom *ebiten.GeoM)
- func Assert(expr bool, message string)
- func Check(e error)
- func Clamp[T constraints.Float | constraints.Integer](current, min, max T) T
- func CodeBlock[T any](name string, description string, factory func() *T)
- func DegToRad(deg float64) float64
- func Errorf(format string, args ...any) error
- func FindActorsByType[T Actor](world *World) []T
- func FindComponentsByType[T Component](parent Component) []T
- func ForEachActorByType[T Actor](world *World, callback func(actor T) error)
- func FrameTime() float64
- func RegisterAllFlatTypes()
- func SliceToSet[T comparable](s []T) map[T]struct{}
- func TypeOf[T any]() reflect.Type
- func WalkComponents(c Component, callback func(target, parent Component))
- func WalkUpComponentOwners(start Component, callback func(comp Component))
- type Actor
- type ActorBase
- func (a *ActorBase) BeginPlay(rootParent Actor)
- func (a *ActorBase) Draw(screen *ebiten.Image)
- func (a *ActorBase) GetComponents() []Component
- func (a *ActorBase) GetTransform() *Transform
- func (a *ActorBase) IsActor()
- func (a *ActorBase) Owner() Component
- func (a *ActorBase) SetComponents(comps []Component)
- func (a *ActorBase) SetOwner(o Component)
- func (a *ActorBase) Update()
- type Bounder
- type Component
- type ComponentBase
- type Drawable
- type EditorPlayable
- type EmptyActor
- type Font
- type Image
- type ImageComponent
- type MouseEvent
- type MouseEventComponent
- type Playable
- type PositionAnchor
- type ScreenPositionComponent
- type TestMouseHandler
- type TextComponent
- type Transform
- type Transformer
- type Updateable
- type World
Constants ¶
This section is empty.
Variables ¶
View Source
var Content embed.FS
View Source
var StopIterating = errors.New("stop iterating actors")
Functions ¶
func ApplyComponentTransforms ¶
func ApplyComponentTransforms(tr Transformer, geom *ebiten.GeoM)
Apply all the transforms up the owning chain so that nested components can have relative transforms
func ApplyTransform ¶
func ApplyTransform(transform *Transform, geom *ebiten.GeoM)
func Clamp ¶
func Clamp[T constraints.Float | constraints.Integer](current, min, max T) T
func FindActorsByType ¶
func FindComponentsByType ¶
func ForEachActorByType ¶
func RegisterAllFlatTypes ¶
func RegisterAllFlatTypes()
func SliceToSet ¶
func SliceToSet[T comparable](s []T) map[T]struct{}
func WalkComponents ¶
func WalkUpComponentOwners ¶
Types ¶
type Actor ¶
type Actor interface { Transformer Component Playable IsActor() }
type ActorBase ¶
type ActorBase struct { Transform Transform Components []Component `flat:"inline"` // contains filtered or unexported fields }
func (*ActorBase) GetComponents ¶
func (*ActorBase) GetTransform ¶
func (*ActorBase) SetComponents ¶
type Component ¶
type Component interface { Transformer SetComponents([]Component) GetComponents() []Component SetOwner(owner Component) Owner() Component }
Component
type ComponentBase ¶
type ComponentBase struct { Transform Transform Children []Component `flat:"inline"` // contains filtered or unexported fields }
func (*ComponentBase) GetComponents ¶
func (c *ComponentBase) GetComponents() []Component
func (*ComponentBase) GetTransform ¶
func (c *ComponentBase) GetTransform() *Transform
func (*ComponentBase) Owner ¶
func (c *ComponentBase) Owner() Component
func (*ComponentBase) SetComponents ¶
func (c *ComponentBase) SetComponents(comps []Component)
func (*ComponentBase) SetOwner ¶
func (c *ComponentBase) SetOwner(owner Component)
type EditorPlayable ¶
type EditorPlayable interface {
EditorBeginPlay()
}
EditorPlayable will be called by the editor instead of Begin play in certain editor situations
type EmptyActor ¶
type EmptyActor struct {
ActorBase
}
EmptyActor can be used when you need an actor that is entirely defined by its components
func (*EmptyActor) BeginPlay ¶
func (a *EmptyActor) BeginPlay()
type Font ¶
type Font struct { Name string TtfFile asset.Path `flat:"filter:ttf"` Options opentype.FaceOptions // contains filtered or unexported fields }
func (*Font) DefaultInitialize ¶
func (f *Font) DefaultInitialize()
type ImageComponent ¶
type ImageComponent struct { ComponentBase Image *Image // contains filtered or unexported fields }
func (*ImageComponent) BeginPlay ¶
func (c *ImageComponent) BeginPlay()
func (*ImageComponent) Bounds ¶
func (c *ImageComponent) Bounds() image.Rectangle
func (*ImageComponent) Draw ¶
func (c *ImageComponent) Draw(screen *ebiten.Image)
func (*ImageComponent) String ¶
func (c *ImageComponent) String() string
type MouseEvent ¶
type MouseEventComponent ¶
type MouseEventComponent struct { ComponentBase EventHandler MouseEvent `flat:"inline"` }
func (*MouseEventComponent) BeginPlay ¶
func (m *MouseEventComponent) BeginPlay()
type Playable ¶
type Playable interface {
BeginPlay()
}
Playable will be called right before a world is ready to run and start ticking
type PositionAnchor ¶
type PositionAnchor int
const ( UpperLeft PositionAnchor = iota UpperCenter UpperRight CenterLeft CenterCenter CenterRight LowerLeft LowerCenter LowerRight )
type ScreenPositionComponent ¶
type ScreenPositionComponent struct { ComponentBase Anchor PositionAnchor XPercentAwayFromAnchor float32 YPercentAwayFromAnchor float32 XPixelsAwayFromAnchor int32 YPixelsAwayFromAnchor int32 }
func (*ScreenPositionComponent) Draw ¶
func (s *ScreenPositionComponent) Draw(screen *ebiten.Image)
type TestMouseHandler ¶
type TestMouseHandler struct {
ToPrint string
}
func (TestMouseHandler) OnEnter ¶
func (t TestMouseHandler) OnEnter(owner Actor)
func (TestMouseHandler) OnExit ¶
func (t TestMouseHandler) OnExit(owner Actor)
func (TestMouseHandler) OnMouseButton ¶
func (t TestMouseHandler) OnMouseButton(owner Actor, button ebiten.MouseButton)
type TextComponent ¶
type TextComponent struct { ComponentBase Font *Font Color color.RGBA Name string TextTemplate string IgnoreParentRotations bool // contains filtered or unexported fields }
func (*TextComponent) Draw ¶
func (t *TextComponent) Draw(screen *ebiten.Image)
func (*TextComponent) SetValues ¶
func (t *TextComponent) SetValues(data any)
type Transform ¶
func (*Transform) AddRotation ¶
func (*Transform) DefaultInitialize ¶
func (t *Transform) DefaultInitialize()
type Transformer ¶
type Transformer interface {
GetTransform() *Transform
}
type Updateable ¶
type Updateable interface {
Update()
}
type World ¶
type World struct { PersistentActors []Actor `flat:"inline"` // contains filtered or unexported fields }
func (*World) AddToWorld ¶
func (*World) EditorBeginPlay ¶
func (w *World) EditorBeginPlay()
func (*World) RemoveFromWorld ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.