panes

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UICautionColor renderer.RGB = renderer.RGBFromHex(0xB7B513)
View Source
var UIErrorColor renderer.RGB = renderer.RGBFromHex(0xE94242)
View Source
var UITextColor renderer.RGB = renderer.RGB{R: 0.85, G: 0.85, B: 0.85}
View Source
var UITextHighlightColor renderer.RGB = renderer.RGBFromHex(0xB2B338)

Functions

func DrawPanes

func DrawPanes(pane Pane, p platform.Platform, r renderer.Renderer,
	controlClient *client.ControlClient, menuBarHeight float32, lg *log.Logger) renderer.RendererStats

DrawPanes renders a single radar pane that fills the entire display area below the menu bar.

func DrawPinButton added in v0.14.2

func DrawPinButton(windowTitle string, unpinnedWindows map[string]struct{}, p platform.Platform)

DrawPinButton draws a thumbtack toggle in the title bar of the current imgui window. Uses the draw list so it doesn't affect auto-resize layout. Call immediately after imgui.BeginV().

Types

type Context

type Context struct {
	PaneExtent       math.Extent2D
	ParentPaneExtent math.Extent2D

	Platform platform.Platform
	// If we want something to be n pixels big, scale factor to apply to n.
	// (This is necessary for Windows high-DPI displays, which just expose
	// their native resolution to us, vs. Mac which pretends retina
	// displays are 72dpi as far as graphics commands.)
	DrawPixelScale float32
	PixelsPerInch  float32
	// DPIScale is similar to DrawPixelScale but always includes the
	// "retina" factor; this is mostly useful for drawing "chunky" 1
	// pixel-wide lines and the like.
	DPIScale float32

	Renderer  renderer.Renderer
	Mouse     *platform.MouseState
	Keyboard  *platform.KeyboardState
	HaveFocus bool
	SimTime   sim.Time
	Lg        *log.Logger

	MenuBarHeight float32

	KeyboardFocus *KeyboardFocus

	Client *client.ControlClient

	// from Client.State, here for convenience
	UserTCW            sim.TCW // User's workstation identifier
	NmPerLongitude     float32
	MagneticVariation  float32
	FacilityAdaptation *sim.FacilityAdaptation
	// contains filtered or unexported fields
}

func NewFuzzContext added in v0.13.3

func NewFuzzContext(p platform.Platform, r renderer.Renderer, c *client.ControlClient, lg *log.Logger) *Context

NewFuzzContext creates a Context suitable for fuzz testing. This is used by the -starsrandoms mode to inject random commands.

func (*Context) GetOurTrackByACID

func (ctx *Context) GetOurTrackByACID(acid sim.ACID) (*sim.Track, bool)

func (*Context) GetOurTrackByCallsign

func (ctx *Context) GetOurTrackByCallsign(callsign av.ADSBCallsign) (*sim.Track, bool)

func (*Context) GetResolvedController added in v0.13.3

func (ctx *Context) GetResolvedController(pos sim.ControlPosition) *av.Controller

GetResolvedController returns the controller for the given position, resolving consolidated secondary positions to their controlling primary. Returns nil if not found.

func (*Context) GetTrackByACID

func (ctx *Context) GetTrackByACID(acid sim.ACID) (*sim.Track, bool)

func (*Context) GetTrackByCallsign

func (ctx *Context) GetTrackByCallsign(callsign av.ADSBCallsign) (*sim.Track, bool)

Convenience methods since these are frequently used.

func (*Context) InitializeMouse

func (ctx *Context) InitializeMouse(p platform.Platform)

func (*Context) IsHandoffToUser added in v0.13.3

func (ctx *Context) IsHandoffToUser(trk *sim.Track) bool

IsHandoffToUser returns true if the given track is being handed off to any of the user's controlled TCPs (primary or secondary).

func (*Context) PaneToWindow

func (ctx *Context) PaneToWindow(p [2]float32) [2]float32

func (*Context) PrimaryTCPForTCW added in v0.13.3

func (ctx *Context) PrimaryTCPForTCW(tcw sim.TCW) sim.TCP

func (*Context) ResolveController added in v0.13.3

func (ctx *Context) ResolveController(pos sim.ControlPosition) sim.ControlPosition

ResolveController returns the signed-in controller who controls the given position. If the position is a primary controller, it returns it as-is. If it is a consolidated secondary, it returns the primary position of the controlling TCW.

func (*Context) SetMousePosition

func (ctx *Context) SetMousePosition(p [2]float32)

func (*Context) SetWindowCoordinateMatrices

func (ctx *Context) SetWindowCoordinateMatrices(cb *renderer.CommandBuffer)

func (*Context) TCWIsPrivileged added in v0.13.3

func (ctx *Context) TCWIsPrivileged(tcw sim.TCW) bool

func (*Context) TracksFromACIDSuffix added in v0.13.0

func (ctx *Context) TracksFromACIDSuffix(suffix string) []*sim.Track

Returns all aircraft that match the given suffix. If instructor, returns all matching aircraft; otherwise only ones under the current controller's control are considered for matching.

func (*Context) UserController added in v0.13.3

func (ctx *Context) UserController() *av.Controller

UserController returns the Controller for the user's primary position.

func (*Context) UserControlsPosition added in v0.13.3

func (ctx *Context) UserControlsPosition(pos sim.ControlPosition) bool

UserControlsPosition returns true if the current user controls the given position (either as their primary position or as a consolidated secondary).

func (*Context) UserOwnsFlightPlan added in v0.13.3

func (ctx *Context) UserOwnsFlightPlan(fp *sim.NASFlightPlan) bool

UserOwnsFlightPlan returns true if the current user owns the given flight plan. Track ownership is determined by the OwningTCW field.

func (*Context) UserPrimaryPosition added in v0.13.3

func (ctx *Context) UserPrimaryPosition() sim.ControlPosition

UserPrimaryPosition returns the user's primary position (the position they signed into).

func (*Context) UserWasRedirector added in v0.13.3

func (ctx *Context) UserWasRedirector(redirectors []sim.ControlPosition) bool

UserWasRedirector returns true if any of the user's controlled positions are in the given redirector list.

func (*Context) WindowToPane

func (ctx *Context) WindowToPane(p [2]float32) [2]float32

Convert to pane coordinates: platform gives us the mouse position w.r.t. the full window, so we need to subtract out displayExtent.p0 to get coordinates w.r.t. the current pane. Further, it has (0,0) in the upper left corner of the window, so we need to flip y w.r.t. the full window resolution.

type FlightStripPane

type FlightStripPane struct {
	FontSize int

	DarkMode         bool
	HideOffFrequency bool

	// Display ordering, reconciled each frame with the server list.
	ACIDDisplayOrder []sim.ACID
	// contains filtered or unexported fields
}

func NewFlightStripPane

func NewFlightStripPane() *FlightStripPane

func (*FlightStripPane) Activate

func (fsp *FlightStripPane) Activate(r renderer.Renderer, p platform.Platform, eventStream *sim.EventStream, lg *log.Logger)

func (*FlightStripPane) DisplayName

func (fsp *FlightStripPane) DisplayName() string

func (*FlightStripPane) DrawUI

func (fsp *FlightStripPane) DrawUI(p platform.Platform, config *platform.Config)

func (*FlightStripPane) DrawWindow added in v0.14.1

func (fsp *FlightStripPane) DrawWindow(show *bool, c *client.ControlClient,
	p platform.Platform, unpinnedWindows map[string]struct{}, lg *log.Logger)

func (*FlightStripPane) ResetSim

func (fsp *FlightStripPane) ResetSim(client *client.ControlClient, pl platform.Platform, lg *log.Logger)

type InfoWindowDrawer

type InfoWindowDrawer interface {
	DrawInfo(c *client.ControlClient, p platform.Platform, lg *log.Logger)
}

type KeyboardFocus

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

func (*KeyboardFocus) Current

func (f *KeyboardFocus) Current() any

func (*KeyboardFocus) Release

func (f *KeyboardFocus) Release()

func (*KeyboardFocus) Take

func (f *KeyboardFocus) Take(p any)

type Message

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

func (*Message) Color

func (msg *Message) Color() renderer.RGB

func (*Message) ImguiColor added in v0.14.1

func (msg *Message) ImguiColor() imgui.Vec4

type MessagesPane

type MessagesPane struct {
	FontIdentifier             renderer.FontIdentifier
	AudioAlertSelection        string
	ContactTransmissionsAlert  bool
	ReadbackTransmissionsAlert bool
	// contains filtered or unexported fields
}

func NewMessagesPane

func NewMessagesPane() *MessagesPane

func (*MessagesPane) Activate

func (mp *MessagesPane) Activate(r renderer.Renderer, p platform.Platform, eventStream *sim.EventStream, lg *log.Logger)

func (*MessagesPane) DisplayName

func (mp *MessagesPane) DisplayName() string

func (*MessagesPane) DrawUI

func (mp *MessagesPane) DrawUI(p platform.Platform, config *platform.Config)

func (*MessagesPane) DrawWindow added in v0.14.1

func (mp *MessagesPane) DrawWindow(show *bool, c *client.ControlClient, p platform.Platform,
	unpinnedWindows map[string]struct{}, lg *log.Logger)

func (*MessagesPane) ResetSim

func (mp *MessagesPane) ResetSim(client *client.ControlClient, pl platform.Platform, lg *log.Logger)

type Pane

type Pane interface {
	// Activate is called once at startup time; it should do general,
	// Sim-independent initialization.
	Activate(r renderer.Renderer, p platform.Platform, eventStream *sim.EventStream, lg *log.Logger)

	// LoadedSim is called when vice is restarted and a Sim is loaded from disk.
	LoadedSim(client *client.ControlClient, pl platform.Platform, lg *log.Logger)

	// ResetSim is called when a brand new Sim is launched
	ResetSim(client *client.ControlClient, pl platform.Platform, lg *log.Logger)

	CanTakeKeyboardFocus() bool
	Draw(ctx *Context, cb *renderer.CommandBuffer)
}

Panes (should) mostly operate in window coordinates: (0,0) is lower left, just in their own pane, oblivious to the full window size. Higher level code will handle positioning the panes in the main window.

type PaneUpgrader

type PaneUpgrader interface {
	Upgrade(prev, current int)
}

type UIDrawer

type UIDrawer interface {
	DisplayName() string
	DrawUI(p platform.Platform, config *platform.Config)
}

Jump to

Keyboard shortcuts

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