hud

package
v0.0.0-...-9fc0885 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package with 'head-up display' elements.

Index

Constants

View Source
const (
	LootRange   = 50
	DialogRange = 50
	ActionRange = 50
)

Variables

View Source
var (
	FOWColor pixel.RGBA = pixel.RGBA{0.1, 0.1, 0.1, 0.7}
)

Functions

This section is empty.

Types

type Camera

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

Struct for HUD camera.

func (*Camera) Area

func (c *Camera) Area() *object.Area

Area retuns current area.

func (*Camera) CenterAt

func (c *Camera) CenterAt(pos pixel.Vec)

CenterAt centers camera at specified position.

func (*Camera) ConvCameraPos

func (c *Camera) ConvCameraPos(pos pixel.Vec) pixel.Vec

ConvCameraPos translates specified camera position to area position.

func (*Camera) Draw

func (c *Camera) Draw(win *mtk.Window)

Draw draws camera on specified map.

func (*Camera) Frame

func (c *Camera) Frame() pixel.Rect

Frame returns current camera frame bounds.

func (*Camera) Lock

func (c *Camera) Lock(lock bool)

Lock toggles camera lock.

func (*Camera) Locked

func (c *Camera) Locked() bool

Locked checks whether camera is locked.

func (*Camera) Position

func (c *Camera) Position() pixel.Vec

Position return camera position.

func (*Camera) SetArea

func (c *Camera) SetArea(a *area.Area) error

SetArea sets area for camera to display.

func (*Camera) SetPosition

func (c *Camera) SetPosition(pos pixel.Vec)

SetPosition sets camera position.

func (*Camera) Size

func (c *Camera) Size() pixel.Vec

Size returns camera size.

func (*Camera) Update

func (c *Camera) Update(win *mtk.Window)

Update updates camera.

type CastBar

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

Struct for HUD cast bar. TODO: bar background.

func (*CastBar) Draw

func (cb *CastBar) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws cast bar.

func (*CastBar) Update

func (cb *CastBar) Update(win *mtk.Window)

Update updates cast bar.

type CharacterWindow

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

Struct for HUD character window.

func (*CharacterWindow) Draw

func (cw *CharacterWindow) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws window.

func (*CharacterWindow) DrawArea

func (cw *CharacterWindow) DrawArea() pixel.Rect

DrawArea returns window draw area.

func (*CharacterWindow) Hide

func (cw *CharacterWindow) Hide()

Hide hides window.

func (*CharacterWindow) Opened

func (cw *CharacterWindow) Opened() bool

Opened checks if window is open.

func (*CharacterWindow) Show

func (cw *CharacterWindow) Show()

Show shows window.

func (*CharacterWindow) Size

func (cw *CharacterWindow) Size() pixel.Vec

Size returns window background size.

func (*CharacterWindow) Update

func (cw *CharacterWindow) Update(win *mtk.Window)

Update updates window.

type Chat

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

Chat represents HUD chat window.

func (*Chat) Activate

func (c *Chat) Activate(active bool)

Active toggles chat intput activity.

func (*Chat) Activated

func (c *Chat) Activated() bool

Activated checks whether chat input is active.

func (*Chat) Draw

func (c *Chat) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws chat window.

func (*Chat) DrawArea

func (c *Chat) DrawArea() pixel.Rect

DrawArea returns current chat draw area.

func (*Chat) Echo

func (c *Chat) Echo(text string)

Echo displays specified text in chat log.

func (*Chat) Size

func (c *Chat) Size() pixel.Vec

Size returns chat background size.

func (*Chat) Update

func (c *Chat) Update(win *mtk.Window)

Update updates chat window.

type CombatLogger

type CombatLogger interface {
	objects.Logger
	CombatLog() *objects.Log
}

Interface for objects with combat log.

type CraftingMenu

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

Struct for HUD crafting menu.

func (*CraftingMenu) Draw

func (cm *CraftingMenu) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws menu.

func (*CraftingMenu) DrawArea

func (cm *CraftingMenu) DrawArea() pixel.Rect

DrawArea returns current draw area.

func (*CraftingMenu) Hide

func (cm *CraftingMenu) Hide()

Hide hides menu.

func (*CraftingMenu) Opened

func (cm *CraftingMenu) Opened() bool

Opened checks if menu is open.

func (*CraftingMenu) Show

func (cm *CraftingMenu) Show()

Show shows menu.

func (*CraftingMenu) Size

func (cm *CraftingMenu) Size() pixel.Vec

Size returns menu background size.

func (*CraftingMenu) Update

func (cm *CraftingMenu) Update(win *mtk.Window)

Update updates menu.

type DialogWindow

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

Struct for HUD dialog window.

func (*DialogWindow) Draw

func (dw *DialogWindow) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws window.

func (*DialogWindow) DrawArea

func (dw *DialogWindow) DrawArea() pixel.Rect

DrawArea returns current draw area.

func (*DialogWindow) Hide

func (dw *DialogWindow) Hide()

Hide hides window.

func (*DialogWindow) Opened

func (dw *DialogWindow) Opened() bool

Opened checks if window is open.

func (*DialogWindow) SetDialog

func (dw *DialogWindow) SetDialog(d *dialog.Dialog)

SetDialog sets dialog for window.

func (*DialogWindow) Show

func (dw *DialogWindow) Show()

Show show window.

func (*DialogWindow) Size

func (dw *DialogWindow) Size() pixel.Vec

Size returns window size.

func (*DialogWindow) Update

func (dw *DialogWindow) Update(win *mtk.Window)

Updates updates window.

type FrameTarget

type FrameTarget interface {
	Name() string
	Health() int
	MaxHealth() int
	Mana() int
	MaxMana() int
	Portrait() pixel.Picture
	Effects() []*object.EffectGraphic
}

Interface for HUD frame object.

type HUD

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

Struct for 'head-up display'.

func New

func New(win *mtk.Window) *HUD

New creates new HUD instance.

func (*HUD) Apply

func (hud *HUD) Apply(data res.HUDData) error

Apply applies specified data on the HUD.

func (*HUD) Camera

func (hud *HUD) Camera() *Camera

Camera returns HUD camera.

func (*HUD) ChangeArea

func (hud *HUD) ChangeArea(area *area.Area) error

ChangeArea changes current HUD area.

func (*HUD) Chat

func (hud *HUD) Chat() *Chat

Chat returns HUD chat.

func (*HUD) CloseLoadingScreen

func (hud *HUD) CloseLoadingScreen()

Close loading screen closes loading screen.

func (*HUD) Data

func (hud *HUD) Data() res.HUDData

Data returns data struct for HUD.

func (*HUD) Draw

func (hud *HUD) Draw(win *mtk.Window)

Draw draws HUD elements.

func (*HUD) Exit

func (hud *HUD) Exit()

Exit sends exit request to HUD.

func (*HUD) Exiting

func (hud *HUD) Exiting() bool

Checks whether exit was requested.

func (*HUD) Game

func (hud *HUD) Game() *game.Game

Game returns HUD current game.

func (*HUD) Layout

func (hud *HUD) Layout(id, serial string) *Layout

Layout returns layout for player with specified ID serial value(creates new layout if there is no saved layout for such player).

func (*HUD) OpenLoadingScreen

func (hud *HUD) OpenLoadingScreen(info string)

OpenLoadingScreen opens loading screen with specified loading information.

func (*HUD) PCAvatar

func (hud *HUD) PCAvatar() *object.Avatar

PCAvatar return avatar for player current character.

func (*HUD) Reload

func (hud *HUD) Reload()

Reload reloads HUD layouts for active player.

func (*HUD) RunScript

func (hud *HUD) RunScript(s *ash.Script)

RunScript executes specified script, in case of error sends err message to Mural error log.

func (*HUD) SetActiveChar

func (hud *HUD) SetActiveChar(char *game.Character)

SetActiveChar sets specified game character as active character.

func (*HUD) SetGame

func (hud *HUD) SetGame(g *game.Game)

SetGame sets HUD game.

func (*HUD) SetOnAreaChangedFunc

func (hud *HUD) SetOnAreaChangedFunc(f func(a *area.Area))

SetOnAreaChangedFunc sets function triggered on area change.

func (*HUD) ShowMessage

func (hud *HUD) ShowMessage(msg *mtk.MessageWindow)

ShowMessage displays specified message window in HUD messages queue.

func (*HUD) Update

func (hud *HUD) Update(win *mtk.Window)

Update updated HUD elements.

func (*HUD) UserFocus

func (hud *HUD) UserFocus() *mtk.Focus

UserFocus returns HUD user focus.

type InfoTarget

type InfoTarget interface {
	ID() string
	Serial() string
	Name() string
}

Interface for object info targets.

type InventoryMenu

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

Struct for inventory menu.

func (*InventoryMenu) Draw

func (im *InventoryMenu) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws menu.

func (*InventoryMenu) DrawArea

func (im *InventoryMenu) DrawArea() pixel.Rect

DrawArea returns current menu draw area.

func (*InventoryMenu) Focus

func (im *InventoryMenu) Focus(focus bool)

Focus toggles menu focus.

func (*InventoryMenu) Focused

func (im *InventoryMenu) Focused() bool

Focused checks whether menu is focused.

func (*InventoryMenu) Hide

func (im *InventoryMenu) Hide()

Hide hides menu.

func (*InventoryMenu) Opened

func (im *InventoryMenu) Opened() bool

Opened checks whether menu is open.

func (*InventoryMenu) Show

func (im *InventoryMenu) Show()

Show shows menu.

func (*InventoryMenu) Size

func (im *InventoryMenu) Size() pixel.Vec

Size returns size of menu background.

func (*InventoryMenu) Update

func (im *InventoryMenu) Update(win *mtk.Window)

Update updates menu.

type JournalWindow

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

Struct for HUD journal window.

func (*JournalWindow) Draw

func (jw *JournalWindow) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws window.

func (*JournalWindow) DrawArea

func (jw *JournalWindow) DrawArea() pixel.Rect

DrawArea returns window draw area.

func (*JournalWindow) Hide

func (jw *JournalWindow) Hide()

Hide hides window.

func (*JournalWindow) Opened

func (jw *JournalWindow) Opened() bool

Opened checks if window is open.

func (*JournalWindow) Show

func (jw *JournalWindow) Show()

Show shows window.

func (*JournalWindow) Size

func (jw *JournalWindow) Size() pixel.Vec

Size returns window size.

func (*JournalWindow) Update

func (jw *JournalWindow) Update(win *mtk.Window)

Update updates window.

type Layout

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

Struct for HUD layout. Stores layout of items and skills in menu bar and inventory menu.

func NewLayout

func NewLayout() *Layout

NewLayout creates new HUD layout.

func (*Layout) BarSlotID

func (l *Layout) BarSlotID(ob interface{}) int

BarSlotID returns saved menu bar slot ID for specified object.

func (*Layout) BarSlots

func (l *Layout) BarSlots() map[string]int

BarSlots returns map witg saved bar slots.

func (*Layout) InvSlotID

func (l *Layout) InvSlotID(ob serial.Serialer) int

InvSlotID returns saved inventory slot ID for specified object.

func (*Layout) InvSlots

func (l *Layout) InvSlots() map[string]int

InvSlots returns map with saved inventory slots.

func (*Layout) SaveBarSlot

func (l *Layout) SaveBarSlot(ob interface{}, id int)

SaveBarSlot saves position(slot ID) of specified object at menu bar.

func (*Layout) SaveInvSlot

func (l *Layout) SaveInvSlot(ob *object.ItemGraphic, slotID int)

SaveInvSlot saves position(slot ID) of specified item at inventory slot list.

func (*Layout) SetBarSlots

func (l *Layout) SetBarSlots(m map[string]int)

SetBarSlot sets specified layout map as current menu bar slots content layout.

func (*Layout) SetInvSlots

func (l *Layout) SetInvSlots(m map[string]int)

SetInvSlots sets specified layout map as current inventory slots content layout.

type LoadingScreen

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

Struct for HUD loading screen.

func (*LoadingScreen) Draw

func (ls *LoadingScreen) Draw(win *mtk.Window)

Draw draws loading screen.

func (*LoadingScreen) SetLoadInfo

func (ls *LoadingScreen) SetLoadInfo(text string)

SetLoadInfo sets specified text as current load info text.

func (*LoadingScreen) Update

func (ls *LoadingScreen) Update(win *mtk.Window)

Update updates loading screen.

type LootTarget

type LootTarget interface {
	item.Container
}

Interface for 'lootable' objects.

type LootWindow

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

Struct for HUD loot window.

func (*LootWindow) Draw

func (lw *LootWindow) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws window.

func (*LootWindow) DrawArea

func (lw *LootWindow) DrawArea() pixel.Rect

DrawArea returns current draw area of window background.

func (*LootWindow) Focus

func (lw *LootWindow) Focus(f bool)

Focus toggles window focus.

func (*LootWindow) Focused

func (lw *LootWindow) Focused() bool

Focused checks whether window is focused.

func (*LootWindow) Hide

func (lw *LootWindow) Hide()

Hide hides window.

func (*LootWindow) Opened

func (lw *LootWindow) Opened() bool

Opened checks whether window is open.

func (*LootWindow) SetTarget

func (lw *LootWindow) SetTarget(t LootTarget)

SetTarget sets object with inventory to loot.

func (*LootWindow) Show

func (lw *LootWindow) Show()

Show shows window.

func (*LootWindow) Size

func (lw *LootWindow) Size() pixel.Vec

Size returns size of loot window background.

func (*LootWindow) Update

func (lw *LootWindow) Update(win *mtk.Window)

Update updates window.

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

Struct for HUD menu.

func (m *Menu) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws menu.

func (m *Menu) DrawArea() pixel.Rect

DrawArea returns current draw area of menu background.

func (m *Menu) Focus(focus bool)

Focus toggles menu focus.

func (m *Menu) Focused() bool

Focused checks whether menu is focused.

func (m *Menu) Hide()

Hide hides menu.

func (m *Menu) Opened() bool

Opened checks wheter menu is open.

func (m *Menu) Show()

Show shows menu.

func (m *Menu) Size() pixel.Vec

Size return size of menu background.

func (m *Menu) Update(win *mtk.Window)

Update updates menu.

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

Struct for HUD menu bar.

func (mb *MenuBar) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws menu bar.

func (mb *MenuBar) DrawArea() pixel.Rect

DrawArea return current draw area of bar background.

func (mb *MenuBar) Lock(lock bool)

Lock toggles menu bar lock. When menu bar is locked then button events are no longer handled.

func (mb *MenuBar) Locked() bool

Locked checks if menu bar is locked.

func (mb *MenuBar) Size() pixel.Vec

Size returns size of bar background.

func (mb *MenuBar) Update(win *mtk.Window)

Update updates menu bar.

type Message

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

Struct for log message.

type MessagesByTime

type MessagesByTime []Message

Struct for sorting messages by the messsage time.

func (MessagesByTime) Len

func (mbt MessagesByTime) Len() int

func (MessagesByTime) Less

func (mbt MessagesByTime) Less(i, j int) bool

func (MessagesByTime) Swap

func (mbt MessagesByTime) Swap(i, j int)

type ObjectFrame

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

Struct for object frame with portrait, health/mana bars and effects icons.

func (*ObjectFrame) Draw

func (of *ObjectFrame) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws character frame.

func (*ObjectFrame) DrawArea

func (of *ObjectFrame) DrawArea() pixel.Rect

DrawArea retruns current frame draw area.

func (*ObjectFrame) SetObject

func (of *ObjectFrame) SetObject(ob FrameTarget)

SetObject sets specified object as object to display in frame.

func (*ObjectFrame) Size

func (of *ObjectFrame) Size() pixel.Vec

Size returns size of character frame background.

func (*ObjectFrame) Update

func (of *ObjectFrame) Update(win *mtk.Window)

Update updates character frame.

type ObjectInfo

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

Struct for HUD object info window.

func (*ObjectInfo) Draw

func (oi *ObjectInfo) Draw(win *mtk.Window)

Draw draws info window.

func (*ObjectInfo) Open

func (oi *ObjectInfo) Open(open bool)

SetOpen toggles info window visibility.

func (*ObjectInfo) Opened

func (oi *ObjectInfo) Opened() bool

Opened checks if object info is open.

func (*ObjectInfo) SetObject

func (oi *ObjectInfo) SetObject(ob InfoTarget)

SetObject sets specified object for object info.

func (*ObjectInfo) Update

func (oi *ObjectInfo) Update(win *mtk.Window)

Update updates object info.

type SaveMenu

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

Struct for HUD save game menu.

func (*SaveMenu) Draw

func (sm *SaveMenu) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws menu.

func (*SaveMenu) DrawArea

func (sm *SaveMenu) DrawArea() pixel.Rect

DrawArea return menu background draw area.

func (*SaveMenu) Focus

func (sm *SaveMenu) Focus(focus bool)

Focus toggles menu focus.

func (*SaveMenu) Focused

func (sm *SaveMenu) Focused() bool

Focused checks if menu us focused.

func (*SaveMenu) Hide

func (sm *SaveMenu) Hide()

Hide hides menu.

func (*SaveMenu) Opened

func (sm *SaveMenu) Opened() bool

Opened check if menu is open.

func (*SaveMenu) Show

func (sm *SaveMenu) Show()

Show shows menu.

func (*SaveMenu) Size

func (sm *SaveMenu) Size() pixel.Vec

Size returns menu background size.

func (*SaveMenu) Update

func (sm *SaveMenu) Update(win *mtk.Window)

Update updates menu.

type SkillMenu

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

Struct for skills menu.

func (*SkillMenu) Draw

func (sm *SkillMenu) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws menu.

func (*SkillMenu) DrawArea

func (sm *SkillMenu) DrawArea() pixel.Rect

DrawArea returns menu draw area.

func (*SkillMenu) Focus

func (sm *SkillMenu) Focus(focus bool)

Focus toggles menu focus.

func (*SkillMenu) Focused

func (sm *SkillMenu) Focused() bool

Focused checks whether menu us focused.

func (*SkillMenu) Hide

func (sm *SkillMenu) Hide()

Hide hides menu.

func (*SkillMenu) Opened

func (sm *SkillMenu) Opened() bool

Opened checks whether menu is open.

func (*SkillMenu) Show

func (sm *SkillMenu) Show()

Show shows menu.

func (*SkillMenu) Size

func (sm *SkillMenu) Size() pixel.Vec

Size returns size of menu background.

func (*SkillMenu) Update

func (sm *SkillMenu) Update(win *mtk.Window)

Update updates window.

type TradeWindow

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

Struct for HUD trade window.

func (*TradeWindow) Draw

func (tw *TradeWindow) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws window.

func (*TradeWindow) DrawArea

func (tw *TradeWindow) DrawArea() pixel.Rect

DrawArea returns window draw area.

func (*TradeWindow) Hide

func (tw *TradeWindow) Hide()

Hide hides window.

func (*TradeWindow) Opened

func (tw *TradeWindow) Opened() bool

Opened checks if window is open.

func (*TradeWindow) SetSeller

func (tw *TradeWindow) SetSeller(c item.Container)

SetSeller sets c as seller.

func (*TradeWindow) Show

func (tw *TradeWindow) Show()

Show shows window.

func (*TradeWindow) Size

func (tw *TradeWindow) Size() pixel.Vec

Size returns window background size.

func (*TradeWindow) Update

func (tw *TradeWindow) Update(win *mtk.Window)

Update updates window.

type TrainingWindow

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

Struct for HUD training window.

func (*TrainingWindow) Draw

func (tw *TrainingWindow) Draw(win *mtk.Window, matrix pixel.Matrix)

Draw draws window.

func (*TrainingWindow) DrawArea

func (tw *TrainingWindow) DrawArea() pixel.Rect

DrawArea returns window draw area.

func (*TrainingWindow) Hide

func (tw *TrainingWindow) Hide()

Hide hides window.

func (*TrainingWindow) Opened

func (tw *TrainingWindow) Opened() bool

Opened checks if window is open.

func (*TrainingWindow) SetTrainer

func (tw *TrainingWindow) SetTrainer(t training.Trainer)

SetTrainer sets trainer for window.

func (*TrainingWindow) Show

func (tw *TrainingWindow) Show()

Show shows window.

func (*TrainingWindow) Size

func (tw *TrainingWindow) Size() pixel.Vec

Size returns window background size.

func (*TrainingWindow) Update

func (tw *TrainingWindow) Update(win *mtk.Window)

Update updates window.

Jump to

Keyboard shortcuts

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