ui

package
v0.0.0-...-1659512 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InventoryWidget

type InventoryWidget struct {
	// contains filtered or unexported fields
}

InventoryWidget is able to render a inventory.

func NewInventoryWidget

func NewInventoryWidget(r *renderers.Renderer, font *ttf.Font, dst *sdl.Rect, drawBorder bool) *InventoryWidget

NewInventoryWidget returns a new NewInventoryWidget

func (*InventoryWidget) Render

func (w *InventoryWidget) Render()

Render the InventoryWidget at the given dst rectangle with the given renderer.

func (*InventoryWidget) SetWrapLength

func (w *InventoryWidget) SetWrapLength(wrapLength int)

SetWrapLength defines a new wrap length on how many pixel the text should be wrapped automatically.

func (*InventoryWidget) UpdateInventory

func (w *InventoryWidget) UpdateInventory(inventory *entity.Inventory)

UpdateInventory updates the inventory with the new list of entities.

type TextWidget

type TextWidget struct {
	// contains filtered or unexported fields
}

TextWidget is able to render character stats

func NewTextWidget

func NewTextWidget(r *renderers.Renderer, font *ttf.Font, dst *sdl.Rect, drawBorder bool) *TextWidget

NewTextWidget returns a new TextWidget

func (*TextWidget) AddRow

func (w *TextWidget) AddRow(row string)

AddRow adds a new line of text. If number of lines > max lines, the oldest will be removed.

func (*TextWidget) Clear

func (w *TextWidget) Clear()

Clear clears the content of the TextWidget.

func (*TextWidget) Render

func (w *TextWidget) Render()

Render the TextWidget at the given dst rectangle with the given renderer.

func (*TextWidget) SetText

func (w *TextWidget) SetText(rows []string)

SetText changes the current text to the rows provided as an argument.

func (*TextWidget) SetWrapLength

func (w *TextWidget) SetWrapLength(wrapLength int)

SetWrapLength defines a new wrap length on how many pixel the text should be wrapped automatically.

type UI

type UI struct {
	// contains filtered or unexported fields
}

UI holds all functions and data related to the UI.

func NewUI

func NewUI(r *renderers.Renderer, font *ttf.Font, fontSize int) *UI

NewUI creates a new UI.

func (*UI) AddLogEntry

func (ui *UI) AddLogEntry(text string)

AddLogEntry adds a new entry to the log pane.

func (*UI) Render

func (ui *UI) Render()

Render the UI.

func (*UI) SetInventoryPaneEnabled

func (ui *UI) SetInventoryPaneEnabled(enabled bool)

SetInventoryPaneEnabled shows or hides the inventory.

func (*UI) SetScreenDimensions

func (ui *UI) SetScreenDimensions(width, height int)

SetScreenDimensions sets a new width and height for the current window where the UI is rendered. UI will calculate from that how to position the UI elements on the screen, so make sure it is always current.

func (*UI) SetStatusBarText

func (ui *UI) SetStatusBarText(text string)

SetStatusBarText sets a new text in the status bar.

func (*UI) UpdateCharacterPane

func (ui *UI) UpdateCharacterPane(time uint, currentHP, totalHP, vision, power, defense int32)

UpdateCharacterPane updates the character infos with the information provided.

func (*UI) UpdateInventoryPane

func (ui *UI) UpdateInventoryPane(inventory *entity.Inventory)

UpdateInventoryPane updates the inventory info with the newly provided list.

func (*UI) UpdateMutationsPane

func (ui *UI) UpdateMutationsPane(mutations components.Mutations)

UpdateMutationsPane updates the mutation info with the newly provided list.

Jump to

Keyboard shortcuts

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