Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
CmpLoadDlg.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: CmpLoadDlg.cpp
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
*/
13
14
#include "
MemDebug.h
"
15
#include "
CmpLoadDlg.h
"
16
#include "
Campaign.h
"
17
#include "
Starshatter.h
"
18
#include "
FormatUtil.h
"
19
20
#include "
Game.h
"
21
#include "
DataLoader.h
"
22
#include "
Video.h
"
23
#include "
Keyboard.h
"
24
#include "
Mouse.h
"
25
#include "
ImageBox.h
"
26
#include "
Slider.h
"
27
28
// +--------------------------------------------------------------------+
29
30
CmpLoadDlg::CmpLoadDlg
(
Screen
* s,
FormDef
& def)
31
:
FormWindow
(s, 0, 0, s->Width(), s->Height()),
32
lbl_progress(0), lbl_activity(0), lbl_title(0), img_title(0), show_time(0)
33
{
34
Init
(def);
35
}
36
37
CmpLoadDlg::~CmpLoadDlg
()
38
{
39
}
40
41
void
42
CmpLoadDlg::RegisterControls
()
43
{
44
img_title
= (
ImageBox
*)
FindControl
(100);
45
lbl_title
=
FindControl
(200);
46
lbl_activity
=
FindControl
(101);
47
lbl_progress
= (
Slider
*)
FindControl
(102);
48
}
49
50
void
51
CmpLoadDlg::Show
()
52
{
53
FormWindow::Show
();
54
55
Campaign
* campaign =
Campaign::GetCampaign
();
56
57
if
(campaign) {
58
Bitmap
* bmp = campaign->
GetImage
(3);
59
if
(
img_title
&& bmp) {
60
Rect
tgt_rect;
61
tgt_rect.
w
=
img_title
->
Width
();
62
tgt_rect.
h
=
img_title
->
Height
();
63
64
img_title
->
SetTargetRect
(tgt_rect);
65
img_title
->
SetPicture
(*bmp);
66
}
67
68
if
(
lbl_title
)
69
lbl_title
->
SetText
(campaign->
Name
());
70
}
71
72
show_time
=
Game::RealTime
();
73
}
74
75
// +--------------------------------------------------------------------+
76
77
void
78
CmpLoadDlg::ExecFrame
()
79
{
80
Starshatter
* stars =
Starshatter::GetInstance
();
81
82
if
(stars) {
83
if
(
lbl_activity
)
lbl_activity
->
SetText
(stars->
GetLoadActivity
());
84
if
(
lbl_progress
)
lbl_progress
->
SetValue
(stars->
GetLoadProgress
());
85
}
86
}
87
88
// +--------------------------------------------------------------------+
89
90
void
91
CmpLoadDlg::MoveTo
(
const
Rect
& r)
92
{
93
FormWindow::MoveTo
(r);
94
95
Campaign
* campaign =
Campaign::GetCampaign
();
96
97
if
(campaign &&
img_title
&& campaign->
GetImage
(3)) {
98
Bitmap
* bmp = campaign->
GetImage
(3);
99
100
Rect
tgt_rect;
101
tgt_rect.
w
=
img_title
->
Width
();
102
tgt_rect.
h
=
img_title
->
Height
();
103
104
img_title
->
SetTargetRect
(tgt_rect);
105
img_title
->
SetPicture
(*bmp);
106
}
107
}
108
109
// +--------------------------------------------------------------------+
110
111
bool
112
CmpLoadDlg::IsDone
()
113
{
114
if
(
Game::RealTime
() -
show_time
< 5000)
115
return
false
;
116
117
return
true
;
118
}
Stars45
CmpLoadDlg.cpp
Generated on Tue Jun 5 2012 20:46:49 for Starshatter_Open by
1.8.1