46 int hdgDegree =
static_cast<int>(D3DXToDegree(
compass.
rotate));
47 if (hdgDegree > 360) hdgDegree -= 360;
48 if (hdgDegree < 0) hdgDegree += 360;
49 swprintf_s(msg, 99, L
"%03i", hdgDegree);
50 DrawTextW(msg, 280, 64, DT_NOCLIP, D3DXCOLOR(0.0f, 1.0f, 0.0f, 1.0f), 1,
"HeadingReadout");
53 float pixelPerKm = 265.0f / scale;
57 D3DXVECTOR2 lastWaypoint, nextWaypoint;
64 D3DXVECTOR2 diff2d = D3DXVECTOR2(-diff.x * pixelPerKm, -diff.y * pixelPerKm);
65 D3DXVec2TransformCoord(&diff2d, &diff2d, &matRot);
67 nextWaypoint = D3DXVECTOR2(265,265) + diff2d;
74 switch (waypoint.
type)
76 case Waypoint::WaypointType::FlyoverFix:
81 case Waypoint::WaypointType::FinalApproachFix:
86 case Waypoint::WaypointType::TouchdownZone:
95 swprintf_s(msg, 99, L
"%S", waypoint.
FixId.c_str());
99 course.
height =
static_cast<int>(sqrtf(powf(nextWaypoint.x - lastWaypoint.x, 2.0f) + powf(nextWaypoint.y - lastWaypoint.y, 2.0f)));
100 course.
x =
static_cast<int>((nextWaypoint.x + lastWaypoint.x)*0.5f);
101 course.
y =
static_cast<int>(min(nextWaypoint.y, lastWaypoint.y) - (
course.
height - fabsf(nextWaypoint.y - lastWaypoint.y))*0.5f);
107 course.
rotate = -atan2f(lastWaypoint.y - nextWaypoint.y, lastWaypoint.x - nextWaypoint.x) + D3DX_PI*0.5f;
111 lastWaypoint = nextWaypoint;
D3DXVECTOR3 absoluteLocation() const
virtual void Initialize(Bus *prmBus, Logger *prmLogger, DEVICE_OBJECT *prmDevice, int prmScreenWidth, int prmScreenHeight, std::vector< Font > *prmFonts, bool prmFlip)
std::vector< Waypoint > waypoints
float HeadingTrue
(4) Heading–primary flight crew reference (if selectable, record discrete, true or magnetic); ...
Abstract base class for instrumentation By definition, instruments don't do any of the work (they don...
std::string pathAndFilename
void Render(float fElapsed) override
void Initialize(Bus *prmBus, Logger *prmLogger, DEVICE_OBJECT *prmDevice, int prmScreenWidth, int prmScreenHeight, std::vector< Font > *prmFonts, bool prmFlip) override
MovingMap(int prmX, int prmY, float prmXScale, float prmYScale)
void Initialize(Logger *prmLogger, Bus *prmBus, DEVICE_OBJECT *prmpDevice, int prmScreenHeight, int prmElementX, int prmElementY, bool prmFlip)