minimap

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package minimap brings minimaps: small pictures of the world round a player's camera, of the ground in miniature and the marks of the kinds that have one, the camera's view outlined on it; a click on one takes the camera there.

Plugin

NewPlugin makes the minimaps over a world and its Ground, as Config says: how far round the camera they reach, never past the world's sight, and whether they turn with the camera or keep north up. On a world that does not wrap the circle stays within its edges, the camera's outline moving in it there, and lies round the world's middle on an axis shorter than it. A game makes it after the cameras, hands it to the players with the other handlers and runs it after the cameras (Plugin.RunPlan).

A minimap in a scene

Plugin.For is the minimap of a camera as a picture for a scene: the scene places it and dresses it, ui.TopRight(a.minimap.For(cam, a.player.ID)).Size(220, 220), round with .Masked(ui.Circle). A minimap draws a picture of its own, not the Stage's: the ground's miniature, the marks and the outline, nothing more, cheaply; north is a red triangle hung on the circle's edge (Plugin.Compass, an element the scene lays over the minimap in a box Overhang bigger on every side), pointing north, at the top north up, turned round the circle and with it as the minimap turns; the pointer passes through the compass to the minimap and the picture under, and it hides with the minimap. The minimap is neither an observer of the world's levels nor saved.

Ground and marks

Ground is what lies under a minimap, the world's ground as one picture: the board's and the topography's give theirs. A kind shows on a minimap as its figure's Look declares with Styled(Mark{...}); a kind without a Mark does not.

Vocabulary

Commands, of the settings screen alone: Switch shows the minimaps or hides them, Turn turns them with their cameras or keeps north up. Settings (Settings, saved with the game, in Resources): both. A click on a minimap gives cameras.CenterAt. The red triangle on a minimap's edge points north.

Index

Constants

View Source
const Overhang = 20

Overhang is how far past the minimap's circle its compass reaches, the pixels a scene grows the box it lays the compass over on every side.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Reach is how far from the camera's middle a minimap shows, to its picture's nearer edge,
	// in world units; never past the world's sight (world.Config.LOD).
	Reach float32
	// Turning has a minimap turn with its camera, the way the camera looks running up it; else
	// north is up.
	Turning bool
}

Config is how far round its camera a minimap shows and whether it turns with it.

type Ground

type Ground interface {
	Miniature() (img *render.Image, perUnit float32)
}

Ground is what lies under a minimap: Miniature is the world's ground as a picture, perUnit pixels a world unit from its top-left corner, nil while there is none.

type Mark

type Mark struct {
	Color color.RGBA
	Size  float32
}

Mark is how a kind shows on a minimap, declared in its figure's Look with Styled: a square dot Size pixels across in Color. A kind without one is not shown.

func (Mark) Style

func (Mark) Style()

type Plugin

type Plugin struct {
	*world.Self

	Res Resources
	// contains filtered or unexported fields
}

Plugin is the minimaps: small pictures round the players' cameras of the ground and the marks of the kinds that have one, a click on one taking its camera there.

func NewPlugin

func NewPlugin(w *world.Plugin, ground Ground, cfg Config) *Plugin

NewPlugin makes the minimaps of the world w over ground, nil for none, as cfg says; a reach past the world's sight panics.

func (*Plugin) Compass

func (p *Plugin) Compass(cam camera.Camera) *ui.Element

Compass is a red triangle hung on the edge of cam's minimap pointing north, three quarters of it over the edge, turned round the circle and with it as the minimap turns: a picture for the scene to lay over the minimap in a box Overhang pixels bigger than the minimap's on every side (ui.Layers of the minimap centred at its size and the compass), transparent elsewhere, the pointer passing through it to the minimap and the picture under, hidden with the minimap. Nothing for a camera without a minimap of the plugin's.

func (*Plugin) DefaultBindings

func (p *Plugin) DefaultBindings() []control.Binding

DefaultBindings are none: the minimaps shown and turning are the settings screen's.

func (*Plugin) EventHandler

func (p *Plugin) EventHandler() control.EventHandler

func (*Plugin) For

func (p *Plugin) For(cam camera.Camera, issuer command.Issuer) *ui.Element

For is the minimap of cam as a picture for a scene to place, a click on it moving cam there as issuer's command (cameras.CenterAt).

func (*Plugin) Install

func (p *Plugin) Install(ctx plugin.Installer) error

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Queues

func (p *Plugin) Queues() []command.CommandQueue

Queues are where the minimaps' commands land.

func (*Plugin) Read added in v0.4.0

func (p *Plugin) Read(int) *Read

Read reads the minimaps' settings on worker w of the game's pool, 0 the game's own goroutine.

func (*Plugin) Restore

func (p *Plugin) Restore()

Restore takes the Settings loaded and shows or hides the minimaps as they say.

func (*Plugin) RunPlan

func (p *Plugin) RunPlan(goke.RunCtx, time.Duration)

RunPlan carries the minimaps' commands out and has each follow its camera; after the cameras'.

func (*Plugin) Serializable

func (p *Plugin) Serializable() plugin.Serializable

Serializable is the minimaps' Settings, kept whole.

func (*Plugin) Settings

func (p *Plugin) Settings() []control.Setting

Settings are whether the minimaps are shown and whether they turn (plugin.Tunable).

func (*Plugin) Write added in v0.4.0

func (p *Plugin) Write() *Write

Write changes the minimaps' settings, on the game's goroutine.

type Read added in v0.4.0

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

Read reads the minimaps' settings, the same on every goroutine.

func (*Read) Shown added in v0.4.0

func (r *Read) Shown() bool

Shown reports whether the minimaps are shown.

func (*Read) Turning added in v0.4.0

func (r *Read) Turning() bool

Turning reports whether the minimaps turn with their cameras.

type Resources

type Resources struct {
	Settings Settings
}

Resources is what the minimaps publish: their Settings.

type Settings

type Settings struct {
	Hidden  bool
	Turning bool
}

Settings is what the minimaps let the players adjust, saved with the game.

type Switch

type Switch struct{ Shown bool }

Switch shows the minimaps, or hides them (Settings.Hidden). The settings screen alone.

func (Switch) Command

func (Switch) Command()

type Turn

type Turn struct{ On bool }

Turn has the minimaps turn with their cameras, or keep north up (Settings.Turning). The settings screen alone.

func (Turn) Command

func (Turn) Command()

type Write added in v0.4.0

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

Write changes the minimaps' settings, on the game's goroutine.

func (*Write) SetReach added in v0.4.0

func (w *Write) SetReach(reach float32)

SetReach has the minimaps show reach round their cameras, from the frame drawn after the next publish; past the world's sight panics.

func (*Write) SetTurning added in v0.4.0

func (w *Write) SetTurning(on bool)

SetTurning has the minimaps turn with their cameras, or keep north up (Settings.Turning).

func (*Write) Show added in v0.4.0

func (w *Write) Show(on bool)

Show has the minimaps shown, or hidden (Settings.Hidden).

Jump to

Keyboard shortcuts

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