Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Direction ¶
type Direction int
Direction is the direction for the pad.
const ( // None describes that no direction buttons are pressed. None Direction = iota // Left is left direction Left // Right is right direction. Right // Upper is the upper direction. Upper // UpperLeft is the upper left direction UpperLeft // UpperRight is the upper right direction UpperRight // Lower is the lower direction. Lower // LowerLeft is the lower left direction LowerLeft // LowerRight is the lower right direction LowerRight )
type DirectionalPad ¶
type DirectionalPad struct {
// contains filtered or unexported fields
}
DirectionalPad is the directional pad for a game.
func NewDirectionalPad ¶
func NewDirectionalPad(pad, button *ebiten.Image) (*DirectionalPad, error)
NewDirectionalPad returns a new DirectionalPad.
func (*DirectionalPad) Draw ¶
func (dp *DirectionalPad) Draw(screen *ebiten.Image) error
Draw draws the directional buttons belong this struct.
func (*DirectionalPad) GetDirection ¶
func (dp *DirectionalPad) GetDirection() Direction
GetDirection returns the currently selected direction.
func (*DirectionalPad) SetLocation ¶
func (dp *DirectionalPad) SetLocation(x, y int)
SetLocation sets the location to draw this directional pad.
func (*DirectionalPad) Update ¶
func (dp *DirectionalPad) Update() error
Update updates the internal status of this struct.
type JustReleaseButton ¶
type JustReleaseButton struct {
// contains filtered or unexported fields
}
JustReleaseButton is implementation of the TriggerButton to be triggered when just released.
func (*JustReleaseButton) Draw ¶
func (b *JustReleaseButton) Draw(screen *ebiten.Image) error
Draw draws this button.
func (*JustReleaseButton) IsTriggered ¶
func (b *JustReleaseButton) IsTriggered() bool
IsTriggered returns the state of this trigger is pressed. If result is 'true', this is pressed now.
func (*JustReleaseButton) SetLocation ¶
func (b *JustReleaseButton) SetLocation(x, y int)
SetLocation sets the location to draw this button.
func (*JustReleaseButton) Update ¶
func (b *JustReleaseButton) Update()
Update updates the internal state of this button. Please call this before using IsTriggered method.
type PressingButton ¶
type PressingButton struct {
// contains filtered or unexported fields
}
PressingButton is implementation of the TriggerButton to be triggered during being pressed.
func (*PressingButton) Draw ¶
func (b *PressingButton) Draw(screen *ebiten.Image) error
Draw draws this button.
func (*PressingButton) IsTriggered ¶
func (b *PressingButton) IsTriggered() bool
IsTriggered returns the state of this trigger is pressed. If result is 'true', this is pressed now.
func (*PressingButton) SetLocation ¶
func (b *PressingButton) SetLocation(x, y int)
SetLocation sets the location to draw this button.
func (*PressingButton) Update ¶
func (b *PressingButton) Update()
Update updates the internal state of this button. Please call this before using IsTriggered method.
type TriggerButton ¶
type TriggerButton interface { SetLocation(x, y int) Update() IsTriggered() bool Draw(*ebiten.Image) error }
func NewTriggerButton ¶
func NewTriggerButton(img *ebiten.Image, tt TriggerType) (TriggerButton, error)
NewTriggerButton returns a new TriggerButton.
type TriggerType ¶
type TriggerType int
TriggerType is the type for the TriggerButton.
const ( // JustRelease is the button to be triggered when just released only. JustRelease TriggerType = iota // Pressing is the button to be triggered during pressed every frame Pressing // JustPressed is the button to be triggered when just pressed only. JustPressed )