All Classes Functions
HUD.h
1 // ==============================================================
2 // ORBITER MODULE: LaunchMFD
3 // Part of the ORBITER SDK
4 //
5 // Copyright (C) 2004 rjcroy - robust time based pitch autopilot (borrowed code)
6 // Copyright (C) 2004 Dave "Daver" Rowbotham - conversion of rjcroy's autopolot to C++ (borrowed code)
7 // Copyright (C) 2004 Erik H. "Sputnik" Anderson - conversion of the autopilot to energy based (borrowed code)
8 // Copyright (C) 2007 "Vanguard" - dressing up azimuth calcualtions into an MFD (author)
9 // Copyright (C) 2007 Pawel "She'da'Lier" Stiasny - yaw error visual representation (contributor)
10 // Copyright (C) 2008 Mohd "Computerex" Ali - borrowed his code (multiple vessels support) (borrowed code)
11 // Copyright (C) 2008 Chris "Kwan" Jeppesen - borrowed his code (peg guidance) (borrowed code)
12 // Copyright (C) 2008 Steve "agentgonzo" Arch - peg integration, offplane correction, compass, hud display (co-developer)
13 // Copyright (C) 2007-2012 Szymon "Enjo" Ender - everything else ;> (author and maintainer)
14 // All rights reserved
15 //
16 // HUD.cpp - Draws Flight Director on HUD
17 // Authors - Steve "agentgonzo" Arch
18 //
19 // This module calculates the appropriate launch azimuth given
20 // desired orbital inclination and desired orbit altitude. This
21 // MFD takes the planets rotation into account, which provides a
22 // much more accurate azimuth. The calculations are performed
23 // 'on the fly' (technically and methaphorically), meaning that
24 // you get info about necessary course corrections.
25 //
26 // This file is part of LaunchMFD.
27 //
28 // LaunchMFD is free software: you can redistribute it and/or modify
29 // it under the terms of the GNU General Public License as published by
30 // the Free Software Foundation, either version 3 of the License, or
31 // (at your option) any later version.
32 //
33 // LaunchMFD is distributed in the hope that it will be useful,
34 // but WITHOUT ANY WARRANTY; without even the implied warranty of
35 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 // GNU General Public License for more details.
37 //
38 // You should have received a copy of the GNU General Public License
39 // along with LaunchMFD. If not, see <http://www.gnu.org/licenses/>.
40 // ==============================================================
41 
42 
43 #pragma once
44 
45 #include <Orbitersdk.h>
46 #include "MyDC.h"
47 
48 #define MoveToExFloat(hdc, x, y, lppoint) MoveToEx(hdc, (int)(x + 0.5), (int)(y + 0.5), lppoint)
49 #define LineToFloat(hdc, x, y) LineTo(hdc, (int)(x + 0.5), (int)(y + 0.5))
50 #define TextOutFloat(hdc, x, y, str, n) TextOut(hdc, (int)(x + 0.5), (int)(y + 0.5), str, n)
51 
52 class HUD
53 {
54 public:
55  HUD();
56  ~HUD();
57  static void SetScale(const HUDPAINTSPEC *hps);
58 
59 protected:
60  void DrawCross(MyDC hDC, POINT p, double bank = 0, int crosslen = 15); // bank is measured in radians clockwise
61  void DrawArrow(MyDC hDC, double angle, double triangleAngle = 25 * RAD, int sideLength = 20);
62  void DrawCircle(MyDC hDC, POINT centre, double radius);
63  virtual void DrawHUD(int mode, const HUDPAINTSPEC *hps, MyDC hDC) = 0;
64 
65 protected:
66  static int W;
67  static int H;
68  static int cX, cY; // value of the centre of the window
69  static double pixelsPerDegree;
70 
71 private:
72  //static HWND hwnd;
73 };