Avionics
Dropship Simulator
Instrument Class Referenceabstract

Abstract base class for instrumentation By definition, instruments don't do any of the work (they don't modify values) If you have something that takes data like VSI and AGL and then triggers GPWS that would be in a module This is presentation layer only - because we can have multiple copies of a particular instrument concurrently displayed What if we don't have data on the bus for the instrument, like FMS stores the waypoint order, waypoint locations? N1 and ITT are different, we are reading from sensors that could be flawed... not from FADEC directly. More...

#include <Instrument.h>

Inheritance diagram for Instrument:
[legend]
Collaboration diagram for Instrument:
[legend]

Public Member Functions

 Instrument (int prmX, int prmY, float prmXScale, float prmYScale)
 
virtual void Initialize (Bus *prmBus, Logger *prmLogger, DEVICE_OBJECT *prmDevice, int prmScreenWidth, int prmScreenHeight, std::vector< Font > *prmFonts, bool prmFlip)
 
void DrawText (const WCHAR *str, int x, int y, int flags, D3DXCOLOR color, int font, std::string elementName)
 
virtual void Render (float fElapsed)=0
 
virtual ~Instrument ()
 

Protected Attributes

Busbus = nullptr
 
Loggerlogger = nullptr
 
int screenWidth = 0
 
int screenHeight = 0
 
DEVICE_OBJECTpDevice = nullptr
 
std::vector< Font > * fonts = nullptr
 
bool flip = false
 
int x
 
int y
 
int width = 0
 
int height = 0
 
float xScale
 
float yScale
 
int standardWidth = 0
 
int standardHeight = 0
 

Private Member Functions

 Instrument ()
 

Detailed Description

Abstract base class for instrumentation By definition, instruments don't do any of the work (they don't modify values) If you have something that takes data like VSI and AGL and then triggers GPWS that would be in a module This is presentation layer only - because we can have multiple copies of a particular instrument concurrently displayed What if we don't have data on the bus for the instrument, like FMS stores the waypoint order, waypoint locations? N1 and ITT are different, we are reading from sensors that could be flawed... not from FADEC directly.

Definition at line 15 of file Instrument.h.

Constructor & Destructor Documentation

◆ Instrument() [1/2]

Instrument::Instrument ( )
private

◆ Instrument() [2/2]

Instrument::Instrument ( int  prmX,
int  prmY,
float  prmXScale,
float  prmYScale 
)
inline
Todo:
viewport has a theme which is passed to Render? or instruments can have bgcolor, fgcolor, font color?

Definition at line 37 of file Instrument.h.

◆ ~Instrument()

virtual Instrument::~Instrument ( )
inlinevirtual

Polymorphism gotcha - if this isn't here then std::vector embedded in derived classes don't clean up!

See also
http://www.cplusplus.com/forum/general/17754/ My theory is that they won't inherit a public destructor if one isn't declared in the base class

Definition at line 80 of file Instrument.h.

Member Function Documentation

◆ DrawText()

void Instrument::DrawText ( const WCHAR *  str,
int  x,
int  y,
int  flags,
D3DXCOLOR  color,
int  font,
std::string  elementName 
)
inline

restore

Definition at line 56 of file Instrument.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize()

virtual void Instrument::Initialize ( Bus prmBus,
Logger prmLogger,
DEVICE_OBJECT prmDevice,
int  prmScreenWidth,
int  prmScreenHeight,
std::vector< Font > *  prmFonts,
bool  prmFlip 
)
inlinevirtual

Reimplemented in MovingMap, ITTIndicator, N1Indicator, AlertMessageStack, FlightModeAnnunciator, HeadingIndicator, AltitudeTape, AttitudeIndicator, and IndicatedAirSpeedTape.

Definition at line 45 of file Instrument.h.

Here is the caller graph for this function:

◆ Render()

virtual void Instrument::Render ( float  fElapsed)
pure virtual

Implemented in MovingMap, ITTIndicator, N1Indicator, Diagnostics, AlertMessageStack, FlightModeAnnunciator, HeadingIndicator, AltitudeTape, AttitudeIndicator, and IndicatedAirSpeedTape.

Here is the caller graph for this function:

Member Data Documentation

◆ bus

Bus* Instrument::bus = nullptr
protected

Definition at line 21 of file Instrument.h.

◆ flip

bool Instrument::flip = false
protected

Definition at line 26 of file Instrument.h.

◆ fonts

std::vector<Font>* Instrument::fonts = nullptr
protected

Definition at line 25 of file Instrument.h.

◆ height

int Instrument::height = 0
protected

Definition at line 30 of file Instrument.h.

◆ logger

Logger* Instrument::logger = nullptr
protected

Definition at line 22 of file Instrument.h.

◆ pDevice

DEVICE_OBJECT* Instrument::pDevice = nullptr
protected

Definition at line 24 of file Instrument.h.

◆ screenHeight

int Instrument::screenHeight = 0
protected

Definition at line 23 of file Instrument.h.

◆ screenWidth

int Instrument::screenWidth = 0
protected

Definition at line 23 of file Instrument.h.

◆ standardHeight

int Instrument::standardHeight = 0
protected

Definition at line 32 of file Instrument.h.

◆ standardWidth

int Instrument::standardWidth = 0
protected

Definition at line 32 of file Instrument.h.

◆ width

int Instrument::width = 0
protected

Definition at line 30 of file Instrument.h.

◆ x

int Instrument::x
protected

Definition at line 29 of file Instrument.h.

◆ xScale

float Instrument::xScale
protected

Definition at line 31 of file Instrument.h.

◆ y

int Instrument::y
protected

Definition at line 29 of file Instrument.h.

◆ yScale

float Instrument::yScale
protected

Definition at line 31 of file Instrument.h.


The documentation for this class was generated from the following file: