Documentation ¶
Index ¶
- type Action
- type Actioner
- type Below
- type Binds
- func (b *Binds) ActiveActions() []Action
- func (b *Binds) Init()
- func (b *Binds) IsActionActive(a Action) bool
- func (b *Binds) IsActionHeld(a Action) int
- func (b *Binds) SetActionKeys(a Action, k []ebiten.Key)
- func (b *Binds) SetMultiAction(action Action, actions []Action)
- func (b *Binds) Update(ctx ifs.RunContext)
- type Data
- type Grid
- func (grid *Grid) CellSize() (int, int)
- func (grid *Grid) Color() color.Color
- func (grid *Grid) Draw(ctx ifs.DrawContext)
- func (grid *Grid) Offset() (x, y int)
- func (grid *Grid) SetCellSize(w, h int)
- func (grid *Grid) SetClickHandler(cb func(x, y int))
- func (grid *Grid) SetColor(c color.Color)
- func (grid *Grid) SetHeldHandler(cb func(x, y int))
- func (grid *Grid) SetOffset(x, y int)
- func (grid *Grid) SetSize(w, h int)
- func (grid *Grid) Size() (int, int)
- func (grid *Grid) Update(ctx ifs.RunContext)
- type Hotbar
- type Inventory
- type MultiAction
- type Pather
- type Scroller
- func (scroller *Scroller) CenterTo(x, y int)
- func (scroller *Scroller) GetConstrainedMousePosition() (int, int)
- func (scroller *Scroller) Init()
- func (scroller *Scroller) Limit() (int, int)
- func (scroller *Scroller) Scroll() (int, int)
- func (scoller *Scroller) SetHandler(cb func(x, y int))
- func (scroller *Scroller) SetLimit(x, y int)
- func (scroller *Scroller) SetScroll(x, y int)
- func (scroller *Scroller) Update(ctx ifs.RunContext) error
- type Sounds
- type Statbar
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actioner ¶
type Actioner struct {
// contains filtered or unexported fields
}
Actioner converts bind actions into move directions.
type Below ¶
type Below struct { Data Data ApplyItem func(wid id.WID) PickupItem func(wid id.WID) DropItem func(wid id.WID) // contains filtered or unexported fields }
type Binds ¶
type Binds struct { Keys map[ebiten.Key]Action Actions map[Action][]ebiten.Key // contains filtered or unexported fields }
Binds provides a way to map input to game actions. Keys can be bound to actions that then allow the game state to determine if a particular action is active or not. Additionally, "multi actions" can be triggered when one or more actions are fulfilled.
func (*Binds) ActiveActions ¶
ActiveActions returns the current active actions.
func (*Binds) Init ¶
func (b *Binds) Init()
Init initializes the binds structures and sets up some default binds.
func (*Binds) IsActionActive ¶
IsActionActive returns if the given action is active.
func (*Binds) IsActionHeld ¶
IsActionHeld returns how many ticks an action has been held. It returns -1 if the action is not held. It may return 0 on the first tick of being held.
func (*Binds) SetActionKeys ¶
SetActionKey sets an action associated with a key.
func (*Binds) SetMultiAction ¶
SetMultiAction sets an action associated with multiple actions.
func (*Binds) Update ¶
func (b *Binds) Update(ctx ifs.RunContext)
Update is called per tick and synchronizes inputs to actions.
type Grid ¶
type Grid struct {
// contains filtered or unexported fields
}
Grid renders a grid over an area.
func (*Grid) SetClickHandler ¶
SetClickHandler sets the grid's click handler.
func (*Grid) SetHeldHandler ¶
SetHeldHandler sets the grid's held handler.
func (*Grid) Update ¶
func (grid *Grid) Update(ctx ifs.RunContext)
type Hotbar ¶
type Hotbar struct {
// contains filtered or unexported fields
}
func (*Hotbar) Update ¶
func (hb *Hotbar) Update(ctx ifs.RunContext)
type Inventory ¶
type Inventory struct { Data Data ApplyItem func(wid id.WID, apply bool) DropItem func(wid id.WID) PickupItem func(wid id.WID) // contains filtered or unexported fields }
type MultiAction ¶
MultiAction maps one or more actions to represent another action. For example, if the two actions "move-left" and "move-up" are active, a multi action could convert that into a "move-up-left" action.
func (*MultiAction) HasActions ¶
func (ma *MultiAction) HasActions(actions []Action) bool
HasActions returns if the passed in actions fulfill the multi action's actions.
type Pather ¶
type Scroller ¶
type Scroller struct {
// contains filtered or unexported fields
}
Scroller allows an area within the limits of the window screen. It will allow areas smaller than the screen to be moved within the screen's bounds and will allow areas beyond the screen to be scrolled into view, up to the screen's bounds.
func (*Scroller) GetConstrainedMousePosition ¶
GetConstrainedMousePosition gets the mouse position fully constrained to the current window's dimensions.
func (*Scroller) SetHandler ¶
SetHandler sets the scroller's handler.
type Sounds ¶
type Sounds struct {
// contains filtered or unexported fields
}
Sounds provides a visual rendering of sounds in the game world. It manages their timeout, etc.
func (*Sounds) Draw ¶
func (sounds *Sounds) Draw(ctx ifs.DrawContext)
Draw draws the sounds to the provided context's screen.