Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
HUDView.h
Go to the documentation of this file.
1
/* Project Starshatter 4.5
2
Destroyer Studios LLC
3
Copyright © 1997-2004. All Rights Reserved.
4
5
SUBSYSTEM: Stars.exe
6
FILE: HUDView.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
View class for Heads Up Display
13
*/
14
15
#ifndef HUDView_h
16
#define HUDView_h
17
18
#include "
Types.h
"
19
#include "
View.h
"
20
#include "
Bitmap.h
"
21
#include "
Font.h
"
22
#include "
System.h
"
23
#include "
SimObject.h
"
24
#include "
Text.h
"
25
26
// +--------------------------------------------------------------------+
27
28
class
Graphic
;
29
class
Sprite
;
30
class
Solid
;
31
class
Ship
;
32
class
Contact
;
33
class
Physical
;
34
class
OrbitalBody
;
35
class
OrbitalRegion
;
36
class
Instruction
;
37
class
CameraView
;
38
class
Projector
;
39
class
MFD
;
40
41
// +--------------------------------------------------------------------+
42
43
class
HUDView
:
public
View
,
44
public
SimObserver
45
{
46
public
:
47
HUDView
(
Window
* c);
48
virtual
~HUDView
();
49
50
enum
HUDModes
{
HUD_MODE_OFF
,
HUD_MODE_TAC
,
HUD_MODE_NAV
,
HUD_MODE_ILS
};
51
52
// Operations:
53
virtual
void
Refresh
();
54
virtual
void
OnWindowMove
();
55
virtual
void
ExecFrame
();
56
virtual
void
UseCameraView
(
CameraView
* v);
57
58
virtual
Ship
*
GetShip
()
const
{
return
ship
; }
59
virtual
SimObject
*
GetTarget
()
const
{
return
target
; }
60
virtual
void
SetShip
(
Ship
* s);
61
virtual
void
SetTarget
(
SimObject
* t);
62
virtual
MFD
*
GetMFD
(
int
n)
const
;
63
64
virtual
void
HideAll
();
65
virtual
void
DrawBars
();
66
virtual
void
DrawNav
();
67
virtual
void
DrawILS
();
68
virtual
void
DrawObjective
();
69
virtual
void
DrawNavInfo
();
70
virtual
void
DrawNavPoint
(
Instruction
& navpt,
int
index,
int
next);
71
virtual
void
DrawContactMarkers
();
72
virtual
void
DrawContact
(
Contact
* c,
int
index);
73
virtual
void
DrawTrack
(
Contact
* c);
74
virtual
void
DrawTrackSegment
(
Point
& t1,
Point
& t2,
Color
c);
75
virtual
void
DrawRect
(
SimObject
* targ);
76
virtual
void
DrawTarget
();
77
virtual
void
DrawSight
();
78
virtual
void
DrawLCOS
(
SimObject
* targ,
double
dist);
79
virtual
void
DrawDesignators
();
80
virtual
void
DrawFPM
();
81
virtual
void
DrawHPM
();
82
virtual
void
DrawCompass
();
83
virtual
void
HideCompass
();
84
virtual
void
DrawPitchLadder
();
85
virtual
void
DrawStarSystem
();
86
87
virtual
void
DrawMFDs
();
88
virtual
void
DrawWarningPanel
();
89
virtual
void
DrawInstructions
();
90
virtual
void
DrawMessages
();
91
92
virtual
void
MouseFrame
();
93
94
virtual
int
GetHUDMode
()
const
{
return
mode
; }
95
virtual
int
GetTacticalMode
()
const
{
return
tactical
; }
96
virtual
void
SetTacticalMode
(
int
mode
=1);
97
virtual
int
GetOverlayMode
()
const
{
return
overlay
; }
98
virtual
void
SetOverlayMode
(
int
mode
=1);
99
100
virtual
void
SetHUDMode
(
int
mode
);
101
virtual
void
CycleHUDMode
();
102
virtual
Color
CycleHUDColor
();
103
virtual
void
SetHUDColorSet
(
int
c);
104
virtual
int
GetHUDColorSet
()
const
{
return
color
; }
105
virtual
Color
GetHUDColor
()
const
{
return
hud_color
; }
106
virtual
Color
GetTextColor
()
const
{
return
txt_color
; }
107
virtual
Color
Ambient
()
const
;
108
virtual
void
ShowHUDWarn
();
109
virtual
void
ShowHUDInst
();
110
virtual
void
HideHUDWarn
();
111
virtual
void
HideHUDInst
();
112
virtual
void
CycleHUDWarn
();
113
virtual
void
CycleHUDInst
();
114
virtual
void
CycleMFDMode
(
int
mfd
);
115
virtual
void
CycleInstructions
(
int
direction);
116
virtual
void
RestoreHUD
();
117
118
virtual
void
TargetOff
() {
target
= 0; }
119
static
Color
MarkerColor
(
Contact
* targ);
120
121
static
bool
IsNameCrowded
(
int
x,
int
y);
122
static
bool
IsMouseLatched
();
123
static
HUDView
*
GetInstance
() {
return
hud_view
; }
124
static
void
Message
(
const
char
* fmt, ...);
125
static
void
ClearMessages
();
126
static
void
PrepareBitmap
(
const
char
* name,
Bitmap
& img, BYTE*& shades);
127
static
void
TransferBitmap
(
const
Bitmap
& src,
Bitmap
& img, BYTE*& shades);
128
static
void
ColorizeBitmap
(
Bitmap
& img, BYTE* shades,
Color
color
,
bool
force_alpha=
false
);
129
130
static
int
GetGunsight
() {
return
gunsight
; }
131
static
void
SetGunsight
(
int
s) {
gunsight
= s; }
132
static
bool
IsArcade
() {
return
arcade
; }
133
static
void
SetArcade
(
bool
a) {
arcade
= a; }
134
static
int
DefaultColorSet
() {
return
def_color_set
; }
135
static
void
SetDefaultColorSet
(
int
c) {
def_color_set
= c; }
136
static
Color
GetStatusColor
(
System::STATUS
status);
137
static
bool
ShowFPS
() {
return
show_fps
; }
138
static
void
ShowFPS
(
bool
f) {
show_fps
= f; }
139
140
virtual
bool
Update
(
SimObject
* obj);
141
virtual
const
char
*
GetObserverName
()
const
;
142
143
protected
:
144
const
char
*
FormatInstruction
(
Text
instr);
145
void
SetStatusColor
(
System::STATUS
status);
146
147
enum
HUD_CASE
{
HUD_MIXED_CASE
,
HUD_UPPER_CASE
};
148
149
void
DrawDiamond
(
int
x,
int
y,
int
r,
Color
c);
150
void
DrawHUDText
(
int
index,
const
char
* txt,
Rect
& rect,
int
align,
int
upcase=
HUD_UPPER_CASE
,
bool
box=
false
);
151
void
HideHUDText
(
int
index);
152
153
void
DrawOrbitalBody
(
OrbitalBody
* body);
154
155
Projector
*
projector
;
156
CameraView
*
camview
;
157
158
int
width
,
height
,
aw
,
ah
;
159
double
xcenter
,
ycenter
;
160
161
Sim
*
sim
;
162
Ship
*
ship
;
163
SimObject
*
target
;
164
165
SimRegion
*
active_region
;
166
167
Bitmap
*
cockpit_hud_texture
;
168
169
Color
hud_color
;
170
Color
txt_color
;
171
Color
status_color
;
172
173
bool
show_warn
;
174
bool
show_inst
;
175
int
inst_page
;
176
int
threat
;
177
178
int
mode
;
179
int
color
;
180
int
tactical
;
181
int
overlay
;
182
int
transition
;
183
int
docking
;
184
185
MFD
*
mfd
[3];
186
187
Sprite
*
pitch_ladder
[31];
188
Sprite
*
hud_sprite
[32];
189
190
Solid
*
az_ring
;
191
Solid
*
az_pointer
;
192
Solid
*
el_ring
;
193
Solid
*
el_pointer
;
194
double
compass_scale
;
195
196
enum
{
MAX_MSG
= 6 };
197
Text
msg_text
[
MAX_MSG
];
198
double
msg_time
[
MAX_MSG
];
199
200
static
HUDView
*
hud_view
;
201
static
bool
arcade
;
202
static
bool
show_fps
;
203
static
int
gunsight
;
204
static
int
def_color_set
;
205
};
206
207
208
// +--------------------------------------------------------------------+
209
210
struct
HUDText
{
211
Font
*
font
;
212
Color
color
;
213
Rect
rect
;
214
bool
hidden
;
215
};
216
217
#endif HUDView_h
218
Stars45
HUDView.h
Generated on Thu May 31 2012 16:31:08 for Starshatter_Open by
1.8.1