Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
AwardShowDlg.cpp
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: AwardShowDlg.cpp
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Main Menu Dialog Active Window class
13
*/
14
15
#include "
MemDebug.h
"
16
#include "
AwardShowDlg.h
"
17
#include "
MenuScreen.h
"
18
#include "
Starshatter.h
"
19
#include "
Ship.h
"
20
#include "
Player.h
"
21
#include "
Campaign.h
"
22
23
#include "
Game.h
"
24
#include "
DataLoader.h
"
25
#include "
Button.h
"
26
#include "
ListBox.h
"
27
#include "
EditBox.h
"
28
#include "
ImageBox.h
"
29
#include "
FormatUtil.h
"
30
#include "
Video.h
"
31
#include "
Keyboard.h
"
32
#include "
Mouse.h
"
33
34
// +--------------------------------------------------------------------+
35
// DECLARE MAPPING FUNCTIONS:
36
37
DEF_MAP_CLIENT
(
AwardShowDlg
, OnClose);
38
39
// +--------------------------------------------------------------------+
40
41
AwardShowDlg::AwardShowDlg
(
Screen
* s,
FormDef
& def,
MenuScreen
* mgr)
42
:
FormWindow
(s, 0, 0, s->Width(), s->Height()), manager(mgr),
43
lbl_name(0), lbl_info(0), img_rank(0), btn_close(0), exit_latch(true),
44
rank(-1), medal(-1)
45
{
46
Init
(def);
47
}
48
49
AwardShowDlg::~AwardShowDlg
()
50
{
51
}
52
53
// +--------------------------------------------------------------------+
54
55
void
56
AwardShowDlg::RegisterControls
()
57
{
58
lbl_name
=
FindControl
(203);
59
lbl_info
=
FindControl
(201);
60
img_rank
= (
ImageBox
*)
FindControl
(202);
61
62
btn_close
= (
Button
*)
FindControl
(1);
63
REGISTER_CLIENT
(
EID_CLICK
,
btn_close
,
AwardShowDlg
,
OnClose
);
64
}
65
66
// +--------------------------------------------------------------------+
67
68
void
69
AwardShowDlg::Show
()
70
{
71
FormWindow::Show
();
72
ShowAward
();
73
}
74
75
// +--------------------------------------------------------------------+
76
77
void
78
AwardShowDlg::ExecFrame
()
79
{
80
if
(
Keyboard::KeyDown
(VK_RETURN)) {
81
if
(!
exit_latch
)
82
OnClose
(0);
83
}
84
85
else
if
(
Keyboard::KeyDown
(VK_ESCAPE)) {
86
if
(!
exit_latch
)
87
OnClose
(0);
88
}
89
90
else
{
91
exit_latch
=
false
;
92
}
93
}
94
95
// +--------------------------------------------------------------------+
96
97
void
98
AwardShowDlg::SetRank
(
int
r)
99
{
100
rank
= r;
101
medal
= -1;
102
}
103
104
void
105
AwardShowDlg::SetMedal
(
int
m)
106
{
107
rank
= -1;
108
medal
= m;
109
}
110
111
// +--------------------------------------------------------------------+
112
113
void
114
AwardShowDlg::ShowAward
()
115
{
116
if
(
rank
>= 0) {
117
if
(
lbl_name
) {
118
lbl_name
->
SetText
(
Text
(
"Rank of "
) +
Player::RankName
(
rank
));
119
}
120
121
if
(
lbl_info
) {
122
lbl_info
->
SetText
(
Player::RankDescription
(
rank
));
123
}
124
125
if
(
img_rank
) {
126
img_rank
->
SetPicture
(*
Player::RankInsignia
(
rank
, 1));
127
img_rank
->
Show
();
128
}
129
}
130
131
else
if
(
medal
>= 0) {
132
if
(
lbl_name
) {
133
lbl_name
->
SetText
(
Player::MedalName
(
medal
));
134
}
135
136
if
(
lbl_info
) {
137
lbl_info
->
SetText
(
Player::MedalDescription
(
medal
));
138
}
139
140
if
(
img_rank
) {
141
img_rank
->
SetPicture
(*
Player::MedalInsignia
(
medal
, 1));
142
img_rank
->
Show
();
143
}
144
}
145
146
else
{
147
if
(
lbl_name
)
lbl_name
->
SetText
(
""
);
148
if
(
lbl_info
)
lbl_info
->
SetText
(
""
);
149
if
(
img_rank
)
img_rank
->
Hide
();
150
}
151
}
152
153
// +--------------------------------------------------------------------+
154
155
void
156
AwardShowDlg::OnClose
(
AWEvent
* event)
157
{
158
manager
->
ShowPlayerDlg
();
159
}
Stars45
AwardShowDlg.cpp
Generated on Thu May 31 2012 16:31:00 for Starshatter_Open by
1.8.1