interactive

package
v0.0.0-...-c5d59ff Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LuaExportInteractiveCallback

func LuaExportInteractiveCallback(in *Interactive, state *lua.LState, table *lua.LTable)

Types

type Component

type Component = Interactive // Component is an alias to Interactive

type ComponentFactory

type ComponentFactory struct {
	*akara.ComponentFactory
}

ComponentFactory is a wrapper for the generic component factory.

func (*ComponentFactory) Add

func (concrete *ComponentFactory) Add(id akara.EID) *Interactive

Add adds a Interactive component to the given entity and returns it

func (*ComponentFactory) ExportToLua

func (concrete *ComponentFactory) ExportToLua(state *lua.LState, table *lua.LTable) *lua.LTable

ExportToLua exports the component into the given table, using the given lua state machine.

func (*ComponentFactory) Get

func (concrete *ComponentFactory) Get(id akara.EID) (*Interactive, bool)

Get returns the Interactive component for the given entity, and a bool for whether or not it exists

type InputCallback

type InputCallback = func() (preventPropogation bool)

type Interactive

type Interactive struct {
	Enabled bool
	*vector.Vector
	Hitbox   *image.Rectangle
	Callback InputCallback
	// TODO: better componentName for this? allows us to temporarily ignore this vector (for debouncing)
	UsedRecently bool
	// TODO: better componentName for this? disables the debouncing functionality so the input callback fires as fast as possible
	RapidFire bool
}

Interactive is used to define an input state and a callback function to execute when that state is reached

func (*Interactive) ExportToLua

func (component *Interactive) ExportToLua(state *lua.LState, table *lua.LTable) *lua.LTable

ExportToLua exports the component into the given table, using the given lua state machine.

func (*Interactive) New

func (*Interactive) New() akara.Component

New returns a Interactive component. By default, it contains a nil instance.

Jump to

Keyboard shortcuts

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