type HandlesHover interface { Hover(x float64, y float64) bool }
type HandlesMouseDown interface { MouseDown(x float64, y float64, button ebiten.MouseButton) bool }
type HandlesMouseUp interface { MouseUp(x float64, y float64, button ebiten.MouseButton) bool }
Logic is an invisible node.
type Logic struct { UpdateFunc func(screen *ebiten.Image) error sync.Mutex // contains filtered or unexported fields }
func NewLogic(updateFunc func(screen *ebiten.Image) error) *Logic
NewLogic returns a new Logic node.
func (l *Logic) AddNode(node Node)
AddNode adds a node.
func (l *Logic) Draw(screen *ebiten.Image)
Draw does nothing.
func (l *Logic) Hit(x float64, y float64) bool
func (l *Logic) HitTest(x float64, y float64) bool
func (l *Logic) Nodes() []Node
Nodes returns any contained nodes.
func (l *Logic) Update(screen *ebiten.Image) error
Update calls UpdateFunc.
Node is an object.
type Node interface { AddNode(Node) HitTest(x float64, y float64) bool Nodes() []Node Update(screen *ebiten.Image) error Draw(screen *ebiten.Image) }
Scene is a node which organizes nodes.
type Scene struct { *Logic }
func NewScene(updateFunc func(screen *ebiten.Image) error) *Scene
NewScene returns a new Scene.
func (n *Scene) Clear()
Clear removes all nodes from a scene.
func (n *Scene) RemoveNode(node Node)
RemoveNode removes the provided node from a scene.
func (n *Scene) SetNode(node Node)
SetNode sets the nodes of a scene.
func (n *Scene) SetNodes(nodes []Node)
SetNodes sets the nodes of a scene.
Sprite is a graphical node.
type Sprite struct { *Logic Image *ebiten.Image Images []*ebiten.Image Visible bool // contains filtered or unexported fields }
func NewSprite(image *ebiten.Image, updateFunc func(screen *ebiten.Image) error) *Sprite
NewSprite returns a new Sprite node.
func (s *Sprite) AddPosition(x float64, y float64)
AddPosition adds to the position of the node.
func (s *Sprite) Draw(screen *ebiten.Image)
Draw draws the node.
func (s *Sprite) GetColorM() *ebiten.ColorM
func (s *Sprite) GetPosition() (x float64, y float64)
GetPosition returns the position of the node.
func (s *Sprite) GetScale() (float64, float64)
SetPosition sets the position of the node.
func (s *Sprite) GetSize() (float64, float64)
func (s *Sprite) HitExact(x float64, y float64) bool
HitExact returns whether the the specified position is within a non-transparent area of the sprite.
func (s *Sprite) HitTest(x float64, y float64) bool
HitTest returns whether the the specified position is within the sprite bounds.
func (s *Sprite) SetColorM(colorm *ebiten.ColorM)
func (s *Sprite) SetImage(image *ebiten.Image)
SetPosition sets the position of the node.
func (s *Sprite) SetPosition(x float64, y float64)
SetPosition sets the position of the node.
func (s *Sprite) SetScale(x float64, y float64)
SetPosition sets the position of the node.