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
- type Config
- type Ground
- type Mark
- type Plugin
- func (p *Plugin) Compass(cam camera.Camera) *ui.Element
- func (p *Plugin) DefaultBindings() []control.Binding
- func (p *Plugin) EventHandler() control.EventHandler
- func (p *Plugin) For(cam camera.Camera, issuer command.Issuer) *ui.Element
- func (p *Plugin) Install(ctx plugin.Installer) error
- func (p *Plugin) Name() string
- func (p *Plugin) Queues() []command.CommandQueue
- func (p *Plugin) Read(int) *Read
- func (p *Plugin) Restore()
- func (p *Plugin) RunPlan(goke.RunCtx, time.Duration)
- func (p *Plugin) Serializable() plugin.Serializable
- func (p *Plugin) Settings() []control.Setting
- func (p *Plugin) Write() *Write
- type Read
- type Resources
- type Settings
- type Switch
- type Turn
- type Write
Constants ¶
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 ¶
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 ¶
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.
type Plugin ¶
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 ¶
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 ¶
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 ¶
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 ¶
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) Queues ¶
func (p *Plugin) Queues() []command.CommandQueue
Queues are where the minimaps' commands land.
func (*Plugin) Read ¶ added in v0.4.0
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 ¶
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.
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.
type Resources ¶
type Resources struct {
Settings Settings
}
Resources is what the minimaps publish: their Settings.
type Switch ¶
type Switch struct{ Shown bool }
Switch shows the minimaps, or hides them (Settings.Hidden). The settings screen alone.
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.
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
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
SetTurning has the minimaps turn with their cameras, or keep north up (Settings.Turning).