Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
MapView.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: MapView.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Star Map class
13
*/
14
15
#ifndef MapView_h
16
#define MapView_h
17
18
#include "
Types.h
"
19
#include "
SimObject.h
"
20
#include "
View.h
"
21
#include "
EventTarget.h
"
22
#include "
Bitmap.h
"
23
#include "
List.h
"
24
#include "
Text.h
"
25
26
// +--------------------------------------------------------------------+
27
28
class
ActiveWindow
;
29
class
StarSystem
;
30
class
Orbital
;
31
class
OrbitalRegion
;
32
class
Ship
;
33
class
Instruction
;
34
class
Mission
;
35
class
MissionElement
;
36
class
Campaign
;
37
class
Combatant
;
38
class
CombatGroup
;
39
class
Menu
;
40
class
MenuItem
;
41
class
MenuView
;
42
class
Font
;
43
44
const
int
EID_MAP_CLICK
= 1000;
45
46
// +--------------------------------------------------------------------+
47
48
class
MapView
:
public
View
,
49
public
EventTarget
,
50
public
SimObserver
51
{
52
public
:
53
MapView
(
Window
* win);
54
virtual
~MapView
();
55
56
// Operations:
57
virtual
void
Refresh
();
58
virtual
void
OnWindowMove
();
59
virtual
void
OnShow
();
60
virtual
void
OnHide
();
61
62
virtual
void
DrawTitle
();
63
virtual
void
DrawGalaxy
();
64
virtual
void
DrawSystem
();
65
virtual
void
DrawRegion
();
66
67
virtual
void
DrawGrid
();
68
virtual
void
DrawOrbital
(
Orbital
& orbital,
int
index);
69
virtual
void
DrawShip
(
Ship
&
ship
,
bool
current=
false
,
int
rep=3);
70
virtual
void
DrawElem
(
MissionElement
& elem,
bool
current=
false
,
int
rep=3);
71
virtual
void
DrawNavRoute
(
OrbitalRegion
* rgn,
72
List<Instruction>
& route,
73
Color
smarker,
74
Ship
* ship=0,
75
MissionElement
* elem=0);
76
77
virtual
void
DrawCombatantSystem
(
Combatant
*
c
,
Orbital
* rgn,
int
x,
int
y,
int
r
);
78
virtual
void
DrawCombatGroupSystem
(
CombatGroup
* g,
Orbital
* rgn,
int
x1,
int
x2,
int
& y,
int
a);
79
virtual
void
DrawCombatGroup
(
CombatGroup
* g,
int
rep=3);
80
81
virtual
int
GetViewMode
()
const
{
return
view_mode
; }
82
virtual
void
SetViewMode
(
int
mode);
83
virtual
void
SetSelectionMode
(
int
mode);
84
virtual
int
GetSelectionMode
()
const
{
return
seln_mode
; }
85
virtual
void
SetSelection
(
int
index);
86
virtual
void
SetSelectedShip
(
Ship
* ship);
87
virtual
void
SetSelectedElem
(
MissionElement
* elem);
88
virtual
void
SetRegion
(
OrbitalRegion
* rgn);
89
virtual
void
SetRegionByName
(
const
char
* rgn_name);
90
virtual
void
SelectAt
(
int
x,
int
y);
91
virtual
Orbital
*
GetSelection
();
92
virtual
Ship
*
GetSelectedShip
();
93
virtual
MissionElement
*
GetSelectedElem
();
94
virtual
int
GetSelectionIndex
();
95
virtual
void
SetShipFilter
(DWORD f) {
ship_filter
= f; }
96
97
// Event Target Interface:
98
virtual
int
OnMouseMove
(
int
x,
int
y);
99
virtual
int
OnLButtonDown
(
int
x,
int
y);
100
virtual
int
OnLButtonUp
(
int
x,
int
y);
101
virtual
int
OnClick
();
102
virtual
int
OnRButtonDown
(
int
x,
int
y);
103
virtual
int
OnRButtonUp
(
int
x,
int
y);
104
105
virtual
bool
IsEnabled
()
const
;
106
virtual
bool
IsVisible
()
const
;
107
virtual
bool
IsFormActive
()
const
;
108
virtual
Rect
TargetRect
()
const
;
109
110
void
ZoomIn
();
111
void
ZoomOut
();
112
113
void
SetGalaxy
(
List<StarSystem>
& systems);
114
void
SetSystem
(
StarSystem
* s);
115
void
SetMission
(
Mission
* m);
116
void
SetShip
(
Ship
* s);
117
void
SetCampaign
(
Campaign
* c);
118
119
bool
IsVisible
(
const
Point
& loc);
120
121
// accessors:
122
virtual
void
GetClickLoc
(
double
& x,
double
& y) { x =
click_x
; y =
click_y
; }
123
List<StarSystem>
&
GetGalaxy
() {
return
system_list
; }
124
StarSystem
*
GetSystem
()
const
{
return
system
; }
125
OrbitalRegion
*
GetRegion
()
const
;
126
127
virtual
bool
Update
(
SimObject
* obj);
128
virtual
const
char
*
GetObserverName
()
const
{
return
"MapWin"
; }
129
130
bool
GetEditorMode
()
const
{
return
editor
; }
131
void
SetEditorMode
(
bool
b) {
editor
= b; }
132
133
protected
:
134
virtual
void
BuildMenu
();
135
virtual
void
ClearMenu
();
136
virtual
void
ProcessMenuItem
(
int
action);
137
virtual
bool
SetCapture
();
138
virtual
bool
ReleaseCapture
();
139
140
virtual
void
DrawTabbedText
(
Font
*
font
,
const
char
* text);
141
142
bool
IsClutter
(
Ship
& s);
143
bool
IsCrowded
(
Ship
& s);
144
bool
IsCrowded
(
MissionElement
& elem);
145
void
GetShipLoc
(
Ship
& s, POINT& loc);
146
void
GetElemLoc
(
MissionElement
& s, POINT& loc);
147
void
SelectShip
(
Ship
* selship);
148
void
SelectElem
(
MissionElement
* selelem);
149
void
SelectNavpt
(
Instruction
* navpt);
150
void
FindShips
(
bool
friendly,
bool
station,
bool
starship,
bool
dropship,
151
List<Text>
& result);
152
void
SetupScroll
(
Orbital
* s);
153
154
double
GetMinRadius
(
int
type);
155
156
Text
title
;
157
Rect
rect
;
158
Campaign
*
campaign
;
159
Mission
*
mission
;
160
List<StarSystem>
system_list
;
161
StarSystem
*
system
;
162
List<Orbital>
stars
;
163
List<Orbital>
planets
;
164
List<Orbital>
regions
;
165
Ship
*
ship
;
166
Bitmap
galaxy_image
;
167
bool
editor
;
168
169
int
current_star
;
170
int
current_planet
;
171
int
current_region
;
172
Ship
*
current_ship
;
173
MissionElement
*
current_elem
;
174
Instruction
*
current_navpt
;
175
int
current_status
;
176
177
int
view_mode
;
178
int
seln_mode
;
179
bool
captured
;
180
bool
dragging
;
181
bool
adding_navpt
;
182
bool
moving_navpt
;
183
bool
moving_elem
;
184
int
scrolling
;
185
int
mouse_x
;
186
int
mouse_y
;
187
DWORD
ship_filter
;
188
189
double
zoom
;
190
double
view_zoom
[3];
191
double
offset_x
;
192
double
offset_y
;
193
double
view_offset_x
[3];
194
double
view_offset_y
[3];
195
double
c
,
r
;
196
double
scroll_x
;
197
double
scroll_y
;
198
double
click_x
;
199
double
click_y
;
200
201
Font
*
font
;
202
Font
*
title_font
;
203
204
ActiveWindow
*
active_window
;
205
Menu
*
active_menu
;
206
207
Menu
*
map_menu
;
208
Menu
*
map_system_menu
;
209
Menu
*
map_sector_menu
;
210
Menu
*
ship_menu
;
211
Menu
*
nav_menu
;
212
Menu
*
action_menu
;
213
Menu
*
objective_menu
;
214
Menu
*
formation_menu
;
215
Menu
*
speed_menu
;
216
Menu
*
hold_menu
;
217
Menu
*
farcast_menu
;
218
219
MenuView
*
menu_view
;
220
};
221
222
#endif MapView_h
223
Stars45
MapView.h
Generated on Tue Jun 5 2012 20:46:56 for Starshatter_Open by
1.8.1