game

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Package game orchestrates client behavior: map input, network reactions, skill commands, local effects, and calls into render, audio, network, world, and ui. Map entity state and movement should live in world; reusable UI composition should live in ui; rendering backend details should live in render.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginMode

type LoginMode struct {
	*login.Screen
	// contains filtered or unexported fields
}

func NewCharacterSelectMode

func NewCharacterSelectMode(ctx client.Context, console gameui.ChatConsole) *LoginMode

func NewLoginMode

func NewLoginMode() *LoginMode

func (*LoginMode) DrawOverlay

func (m *LoginMode) DrawOverlay(ctx client.Context, screen *render.Frame)

func (*LoginMode) Enter

func (m *LoginMode) Enter(ctx client.Context) Mode

func (*LoginMode) Update

func (m *LoginMode) Update(ctx client.Context) (Mode, error)

type Manager

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

func NewManager

func NewManager(ctx client.Context, mode Mode) *Manager

func (*Manager) Close added in v0.17.0

func (m *Manager) Close()

Close releases the active mode after the render loop stops, outside any Lua callback.

func (*Manager) Draw

func (m *Manager) Draw(screen *render.Frame)

func (*Manager) DrawOverlay

func (m *Manager) DrawOverlay(screen *render.Frame)

func (*Manager) DrawUIOverlay

func (m *Manager) DrawUIOverlay(screen *render.Frame)

func (*Manager) FrameSubmitted added in v0.7.0

func (m *Manager) FrameSubmitted()

func (*Manager) HandleGamepadInput added in v0.16.0

func (m *Manager) HandleGamepadInput(ctx client.Context, dt float64) input.GamepadCapture

func (*Manager) HandleKeyPress added in v0.13.0

func (m *Manager) HandleKeyPress(ctx client.Context, code input.KeyCode)

func (*Manager) InLogin added in v0.17.0

func (m *Manager) InLogin() bool

InLogin can be queried by platform UI threads without reading the live mode.

func (*Manager) PrepareKeyInput added in v0.13.0

func (m *Manager) PrepareKeyInput(ctx client.Context, code input.KeyCode, mods gpucontext.Modifiers)

func (*Manager) PrepareTextInput added in v0.13.0

func (m *Manager) PrepareTextInput(ctx client.Context, code input.KeyCode) bool

func (*Manager) Update

func (m *Manager) Update() error

func (*Manager) UpdateContext

func (m *Manager) UpdateContext(ctx client.Context)

type Mode

type Mode interface {
	Name() string
	// Enter may redirect to another mode if this one cannot be entered.
	Enter(client.Context) Mode
	Update(client.Context) (Mode, error)
	Draw(client.Context, *render.Frame)
}

type WorldMode

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

func NewWorldMode

func NewWorldMode() *WorldMode

func (*WorldMode) Draw

func (m *WorldMode) Draw(ctx client.Context, screen *render.Frame)

func (*WorldMode) DrawInventoryItemIcon

func (m *WorldMode) DrawInventoryItemIcon(screen *render.Frame, manager *res.Manager, item session.InventoryItem, x, y int)

func (*WorldMode) DrawOverlay

func (m *WorldMode) DrawOverlay(ctx client.Context, screen *render.Frame)

func (*WorldMode) DrawSkillIcon

func (m *WorldMode) DrawSkillIcon(screen *render.Frame, manager *res.Manager, skill session.Skill, x, y, size int)

func (*WorldMode) DrawUIOverlay

func (m *WorldMode) DrawUIOverlay(ctx client.Context, screen *render.Frame)

func (*WorldMode) EffectCameraYaw added in v0.22.0

func (m *WorldMode) EffectCameraYaw(ctx client.Context) float64

func (*WorldMode) EffectShake added in v0.22.0

func (m *WorldMode) EffectShake(at time.Time, duration time.Duration)

func (*WorldMode) EffectSound added in v0.22.0

func (m *WorldMode) EffectSound(at time.Time, effect effects.Instance, paths ...string)

func (*WorldMode) EffectSoundAtPosition added in v0.22.0

func (m *WorldMode) EffectSoundAtPosition(at time.Time, volume, x, y float64, paths ...string)

func (*WorldMode) EffectSoundGlobal added in v0.22.0

func (m *WorldMode) EffectSoundGlobal(at time.Time, paths ...string)

func (*WorldMode) EffectSpriteTexture added in v0.22.0

func (m *WorldMode) EffectSpriteTexture(image *render.Image) *render.Image

func (*WorldMode) EffectStarted added in v0.22.0

func (m *WorldMode) EffectStarted(ctx client.Context, effect effects.Instance, at time.Time)

func (*WorldMode) Enter

func (m *WorldMode) Enter(ctx client.Context) Mode

func (*WorldMode) EquipmentPreviewImage

func (m *WorldMode) EquipmentPreviewImage(ctx client.Context, width, height int) image.Image

func (*WorldMode) EquipmentPreviewImageForCharacter

func (m *WorldMode) EquipmentPreviewImageForCharacter(ctx client.Context, character session.Character, sex byte, width, height int) image.Image

func (*WorldMode) FrameSubmitted added in v0.7.0

func (m *WorldMode) FrameSubmitted()

func (*WorldMode) HandleKeyPress added in v0.13.0

func (m *WorldMode) HandleKeyPress(ctx client.Context, code input.KeyCode)

HandleKeyPress gives gameplay input handlers a chance to consume a press before default UI dispatch. Focused chat, forms and modals retain priority.

func (*WorldMode) ItemInfoIllustrationImage

func (m *WorldMode) ItemInfoIllustrationImage(manager *res.Manager, item session.InventoryItem, width, height int) image.Image

func (*WorldMode) KeyboardShortcutsBlocked

func (m *WorldMode) KeyboardShortcutsBlocked(ctx client.Context) bool

func (*WorldMode) Leave added in v0.15.0

func (m *WorldMode) Leave()

Leave also covers disconnects, character selection, and failed map loads.

func (*WorldMode) Name

func (m *WorldMode) Name() string

func (*WorldMode) PrepareKeyInput added in v0.13.0

func (m *WorldMode) PrepareKeyInput(ctx client.Context, code input.KeyCode, mods gpucontext.Modifiers)

func (*WorldMode) PrepareTextInput added in v0.13.0

func (m *WorldMode) PrepareTextInput(ctx client.Context, code input.KeyCode) bool

PrepareTextInput routes ordinary typing to classic chat, or filters the text accompanying active shortcuts. Shortcut actions still run in frame input.

func (*WorldMode) SkillIconImage

func (m *WorldMode) SkillIconImage(manager *res.Manager, skill session.Skill) image.Image

func (*WorldMode) Update

func (m *WorldMode) Update(ctx client.Context) (Mode, error)

func (*WorldMode) UseShortcutSkill

func (m *WorldMode) UseShortcutSkill(ctx client.Context, skill session.Skill) error

Directories

Path Synopsis
Package actors manages actor appearance, animation, movement and rendering.
Package actors manages actor appearance, animation, movement and rendering.
Package battle manages combat status, damage numbers and combat overlays.
Package battle manages combat status, damage numbers and combat overlays.
Package companion manages homunculus and mercenary state, commands, and Lua AI.
Package companion manages homunculus and mercenary state, commands, and Lua AI.
internal
Package npc manages NPC dialogs, shops, illustrations and script progress.
Package npc manages NPC dialogs, shops, illustrations and script progress.
Package pet manages pet capture, care, commands and presentation.
Package pet manages pet capture, care, commands and presentation.
Package social manages interactions between players.
Package social manages interactions between players.

Jump to

Keyboard shortcuts

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