Documentation
¶
Index ¶
- Constants
- func ColorFromHex(hexv string) color.RGBA
- func Destroy(obj Object) bool
- func SetDrawFuncs(w *ecs.World, entity ecs.Entity, beforefn, fn, afterfn core.DrawFn) error
- func SetFuncs(w *ecs.World, entity ecs.Entity, beforefn, fn, afterfn core.UpdateFn) error
- type AnimatedSprite
- type Animation
- type Context
- type Dict
- type Engine
- func (e *Engine) AddEventListener(eventName string, fn core.EventFn) core.EventID
- func (e *Engine) AddWorld(w *ecs.World, priority int)
- func (e *Engine) Default() *ecs.World
- func (e *Engine) DispatchEvent(eventName string, data interface{})
- func (e *Engine) Draw(screen *ebiten.Image)
- func (e *Engine) DrawFrame() int64
- func (e *Engine) FS() io.Filesystem
- func (e *Engine) Get(key string) interface{}
- func (e *Engine) Height() int
- func (e *Engine) Layout(outsideWidth, outsideHeight int) (int, int)
- func (e *Engine) Ready() <-chan struct{}
- func (e *Engine) RemoveEventListener(id core.EventID) bool
- func (e *Engine) RemoveWorld(w *ecs.World) bool
- func (e *Engine) Root(w *ecs.World) WorldTransform
- func (e *Engine) Run() error
- func (e *Engine) Set(key string, value interface{})
- func (e *Engine) Update(screen *ebiten.Image) error
- func (e *Engine) UpdateFrame() int64
- func (e *Engine) Width() int
- type EngineOptions
- type Label
- type Layer
- type NewEngineInput
- type Object
- type ObjectContainer
- type Sprite
- type StepInfo
- type Transform
- type TransformGetter
- type TransformItem
- func (t *TransformItem) GetCoreTransform() *core.Transform
- func (t *TransformItem) SetAngle(radians float64)
- func (t *TransformItem) SetParent(parent TransformGetter)
- func (t *TransformItem) SetPos(x, y float64)
- func (t *TransformItem) SetScale(sx, sy float64)
- func (t *TransformItem) SetScale2(s float64)
- func (t *TransformItem) SetX(x float64)
- func (t *TransformItem) SetY(y float64)
- type TransformSetter
- type Transformer
- type WorldItem
- type WorldTag
- type WorldTransform
Constants ¶
const TagDelta = "delta"
TagDelta is the key set of the time taken between frames (in seconds)
Variables ¶
This section is empty.
Functions ¶
func ColorFromHex ¶ added in v0.3.0
ColorFromHex parses a RRGGBBAA (or RRGGBB) hexadecimal color into color.RGBA
Returns color.Transparent on invalid hex inputs.
func SetDrawFuncs ¶ added in v0.3.0
SetDrawFuncs adds a component with the specified draw functions
Types ¶
type AnimatedSprite ¶ added in v0.3.0
type AnimatedSprite struct {
*Sprite
// contains filtered or unexported fields
}
func NewAnimatedSprite ¶ added in v0.3.0
func NewAnimatedSprite(parent WorldTransform, layer Layer, anim Animation) *AnimatedSprite
func (*AnimatedSprite) PlayClip ¶ added in v0.3.0
func (as *AnimatedSprite) PlayClip(name string)
func (*AnimatedSprite) PlayClipIndex ¶ added in v0.3.0
func (as *AnimatedSprite) PlayClipIndex(i int)
type Context ¶
type Context interface {
ecs.Context
Engine() *Engine
FPS() float64
Frame() int64
IsDrawingSkipped() bool
DefaultDrawImageOptions() *ebiten.DrawImageOptions
Screen() *ebiten.Image
}
Context is the context passed to every system update function.
type Dict ¶
type Dict struct {
// contains filtered or unexported fields
}
Dict is a concurrency-safe map.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is what controls the ECS of primen.
func (*Engine) AddEventListener ¶
func (*Engine) AddWorld ¶
AddWorld adds a world to the engine. The priority is used to sort world execution, from hight to low.
func (*Engine) DispatchEvent ¶
func (*Engine) Ready ¶
func (e *Engine) Ready() <-chan struct{}
Ready returns a channel that signals when the engine is ready
func (*Engine) RemoveWorld ¶
RemoveWorld removes a *World
func (*Engine) UpdateFrame ¶
UpdateFrame returns the current frame. Use ctx.Frame() (more performant)
type EngineOptions ¶
type EngineOptions struct {
Width int
Height int
Scale float64
Title string
IsFullscreen bool
IsResizable bool
IsMaxResolution bool
IsTransparentScreen bool
IsFloating bool
IsMaximized bool
IsFixedResolution bool
}
EngineOptions is used to setup Ebiten @ Engine.boot
type Label ¶ added in v0.3.0
type Label struct {
*WorldItem
*TransformItem
// contains filtered or unexported fields
}
func NewLabel ¶ added in v0.3.0
func NewLabel(parent WorldTransform, fontFace font.Face, layer Layer) *Label
func (*Label) ComputedSize ¶ added in v0.3.0
type Layer ¶ added in v0.3.0
type Layer = core.LayerIndex
Layer index type
const ( Layer0 Layer = 0 Layer1 Layer = 1 Layer2 Layer = 2 Layer3 Layer = 3 Layer4 Layer = 4 Layer5 Layer = 5 Layer6 Layer = 6 Layer7 Layer = 7 Layer8 Layer = 8 Layer9 Layer = 9 Layer10 Layer = 10 Layer11 Layer = 11 Layer12 Layer = 12 Layer13 Layer = 13 Layer14 Layer = 14 Layer15 Layer = 15 )
LAYERS
type NewEngineInput ¶
type NewEngineInput struct {
Width int // main window width
Height int // main window height
Scale float64 // pixel scale (default: 1)
TransparentScreen bool // transparent screen
Maximized bool // start window maximized
Floating bool // always on top of all windows
Fullscreen bool // start in fullscreen
Resizable bool // is window resizable?
FixedResolution bool // fixed logical screen resolution
FixedWidth int // fixed logical screen resolution
FixedHeight int // fixed logical screen resolution
MaxResolution bool // set width/height to max resolution
Title string // window title
FS io.Filesystem // TODO: drop this
OnReady func(e *Engine) // function to run once the window is opened
}
NewEngineInput is the input data of NewEngine
func (*NewEngineInput) Options ¶
func (i *NewEngineInput) Options() EngineOptions
Options will create a EngineOptions struct to be used in an *Engine
type ObjectContainer ¶ added in v0.3.0
type ObjectContainer interface {
Children() []Object
}
type Transform ¶
type Transform struct {
*WorldItem
*TransformItem
}
func NewTransform ¶
func NewTransform(parent WorldTransform) *Transform
type TransformGetter ¶ added in v0.3.0
type TransformItem ¶ added in v0.3.0
type TransformItem struct {
// contains filtered or unexported fields
}
func (*TransformItem) GetCoreTransform ¶ added in v0.3.0
func (t *TransformItem) GetCoreTransform() *core.Transform
func (*TransformItem) SetAngle ¶ added in v0.3.0
func (t *TransformItem) SetAngle(radians float64)
func (*TransformItem) SetParent ¶ added in v0.3.0
func (t *TransformItem) SetParent(parent TransformGetter)
func (*TransformItem) SetPos ¶ added in v0.3.0
func (t *TransformItem) SetPos(x, y float64)
func (*TransformItem) SetScale ¶ added in v0.3.0
func (t *TransformItem) SetScale(sx, sy float64)
func (*TransformItem) SetScale2 ¶ added in v0.3.0
func (t *TransformItem) SetScale2(s float64)
func (*TransformItem) SetX ¶ added in v0.3.0
func (t *TransformItem) SetX(x float64)
func (*TransformItem) SetY ¶ added in v0.3.0
func (t *TransformItem) SetY(y float64)
type TransformSetter ¶ added in v0.3.0
type TransformSetter interface {
SetParent(parent TransformGetter)
}
type Transformer ¶ added in v0.3.0
type Transformer interface {
TransformGetter
TransformSetter
}
type WorldItem ¶
type WorldItem struct {
// contains filtered or unexported fields
}
type WorldTransform ¶ added in v0.3.0
type WorldTransform interface {
TransformGetter
World() *ecs.World
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
aseprimen
command
|
|
|
atlaspreview
command
|
|
|
editor
command
|
|
|
tcli
command
|
|
|
Package core contains lower level component systems.
|
Package core contains lower level component systems. |
|
examples
|
|
|
animation
command
|
|
|
hello
command
|
|
|
layers
command
|
|
|
layers/res
Code generated by broccoli at 2020-06-07T18:39:46-03:00.
|
Code generated by broccoli at 2020-06-07T18:39:46-03:00. |
|
sprites
command
|
|
|
transform2
command
|
|
|
transform_sprites
command
|
|
|
Package rx holds default resources for Primen
|
Package rx holds default resources for Primen |
