Documentation
¶
Index ¶
- Variables
- func DrawPanes(pane Pane, p platform.Platform, r renderer.Renderer, ...) renderer.RendererStats
- func DrawPinButton(windowTitle string, unpinnedWindows map[string]struct{}, p platform.Platform)
- type Context
- func (ctx *Context) GetOurTrackByACID(acid sim.ACID) (*sim.Track, bool)
- func (ctx *Context) GetOurTrackByCallsign(callsign av.ADSBCallsign) (*sim.Track, bool)
- func (ctx *Context) GetResolvedController(pos sim.ControlPosition) *av.Controller
- func (ctx *Context) GetTrackByACID(acid sim.ACID) (*sim.Track, bool)
- func (ctx *Context) GetTrackByCallsign(callsign av.ADSBCallsign) (*sim.Track, bool)
- func (ctx *Context) InitializeMouse(p platform.Platform)
- func (ctx *Context) IsHandoffToUser(trk *sim.Track) bool
- func (ctx *Context) PaneToWindow(p [2]float32) [2]float32
- func (ctx *Context) PrimaryTCPForTCW(tcw sim.TCW) sim.TCP
- func (ctx *Context) ResolveController(pos sim.ControlPosition) sim.ControlPosition
- func (ctx *Context) SetMousePosition(p [2]float32)
- func (ctx *Context) SetWindowCoordinateMatrices(cb *renderer.CommandBuffer)
- func (ctx *Context) TCWIsPrivileged(tcw sim.TCW) bool
- func (ctx *Context) TracksFromACIDSuffix(suffix string) []*sim.Track
- func (ctx *Context) UserController() *av.Controller
- func (ctx *Context) UserControlsPosition(pos sim.ControlPosition) bool
- func (ctx *Context) UserOwnsFlightPlan(fp *sim.NASFlightPlan) bool
- func (ctx *Context) UserPrimaryPosition() sim.ControlPosition
- func (ctx *Context) UserWasRedirector(redirectors []sim.ControlPosition) bool
- func (ctx *Context) WindowToPane(p [2]float32) [2]float32
- type FlightStripPane
- func (fsp *FlightStripPane) Activate(r renderer.Renderer, p platform.Platform, eventStream *sim.EventStream, ...)
- func (fsp *FlightStripPane) DisplayName() string
- func (fsp *FlightStripPane) DrawUI(p platform.Platform, config *platform.Config)
- func (fsp *FlightStripPane) DrawWindow(show *bool, c *client.ControlClient, p platform.Platform, ...)
- func (fsp *FlightStripPane) ResetSim(client *client.ControlClient, pl platform.Platform, lg *log.Logger)
- type InfoWindowDrawer
- type KeyboardFocus
- type Message
- type MessagesPane
- func (mp *MessagesPane) Activate(r renderer.Renderer, p platform.Platform, eventStream *sim.EventStream, ...)
- func (mp *MessagesPane) DisplayName() string
- func (mp *MessagesPane) DrawUI(p platform.Platform, config *platform.Config)
- func (mp *MessagesPane) DrawWindow(show *bool, c *client.ControlClient, p platform.Platform, ...)
- func (mp *MessagesPane) ResetSim(client *client.ControlClient, pl platform.Platform, lg *log.Logger)
- type Pane
- type PaneUpgrader
- type UIDrawer
Constants ¶
This section is empty.
Variables ¶
var UICautionColor renderer.RGB = renderer.RGBFromHex(0xB7B513)
var UIErrorColor renderer.RGB = renderer.RGBFromHex(0xE94242)
var UITextColor renderer.RGB = renderer.RGB{R: 0.85, G: 0.85, B: 0.85}
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
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 (*Context) GetOurTrackByCallsign ¶
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 (*Context) GetTrackByCallsign ¶
Convenience methods since these are frequently used.
func (*Context) InitializeMouse ¶
func (*Context) IsHandoffToUser ¶ added in v0.13.3
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 (*Context) PrimaryTCPForTCW ¶ added in v0.13.3
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 (*Context) SetWindowCoordinateMatrices ¶
func (ctx *Context) SetWindowCoordinateMatrices(cb *renderer.CommandBuffer)
func (*Context) TCWIsPrivileged ¶ added in v0.13.3
func (*Context) TracksFromACIDSuffix ¶ added in v0.13.0
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 ¶
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 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) ImguiColor ¶ added in v0.14.1
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)
}