gui

package
v0.0.0-...-27af21b Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	Root       *tview.TextView
	Focused    bool
	Messages   []string
	MaxHistory int
}

func NewChat

func NewChat() *Chat

func (*Chat) AddMessage

func (c *Chat) AddMessage(s string)

type GUI

type GUI struct {
	Root    tview.Primitive
	World   *World
	Chat    *Chat
	Input   *Input
	Sidebar *Sidebar
}

func NewGUI

func NewGUI(gs *game.GameState, inputFunc func(event *tcell.EventKey) *tcell.EventKey) *GUI

func (*GUI) HandleInput

func (g *GUI) HandleInput(event *tcell.EventKey)

type Input

type Input struct {
	Root    *tview.Form
	Focused bool
	Value   string
}

func NewInput

func NewInput() *Input
type Sidebar struct {
	Root            *tview.Grid
	Pages           *tview.Pages
	Nav             *tview.TextView
	Stats           *tview.TextView
	Inventory       *tview.TextView
	InventoryCursor int
}

func NewSidebar

func NewSidebar() *Sidebar

func (*Sidebar) SetActiveTab

func (s *Sidebar) SetActiveTab(name string)

func (*Sidebar) UpdatePlayerInventory

func (s *Sidebar) UpdatePlayerInventory(p *components.Player)

func (*Sidebar) UpdatePlayerStats

func (s *Sidebar) UpdatePlayerStats(p *components.Player)

type World

type World struct {
	Root       *tview.Box
	Focused    bool
	Chunks     []*game.Chunk
	OffsetX    int
	OffsetY    int
	OldOffsetX int
	OldOffsetY int
	Mutex      sync.Mutex
	GameState  *game.GameState
}

func NewWorld

func NewWorld(gs *game.GameState) *World

func (*World) Draw

func (m *World) Draw(screen tcell.Screen, x, y, width, height int)

func (*World) UpdateChunks

func (m *World) UpdateChunks(chunks []*game.Chunk)

Jump to

Keyboard shortcuts

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