Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
LoadScreen.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
6
FILE: LoadScreen.cpp
7
AUTHOR: John DiCamillo
8
9
*/
10
11
#include "
MemDebug.h
"
12
#include "
LoadScreen.h
"
13
#include "
LoadDlg.h
"
14
#include "
CmpLoadDlg.h
"
15
#include "
Starshatter.h
"
16
17
#include "
Game.h
"
18
#include "
Video.h
"
19
#include "
Screen.h
"
20
#include "
FormDef.h
"
21
#include "
Window.h
"
22
#include "
ActiveWindow.h
"
23
#include "
Mouse.h
"
24
#include "
Color.h
"
25
#include "
Bitmap.h
"
26
#include "
Font.h
"
27
#include "
FontMgr.h
"
28
#include "
DataLoader.h
"
29
#include "
Resource.h
"
30
31
// +--------------------------------------------------------------------+
32
33
LoadScreen::LoadScreen
()
34
: screen(0), load_dlg(0), cmp_load_dlg(0), isShown(false)
35
{ }
36
37
LoadScreen::~LoadScreen
()
38
{
39
TearDown
();
40
}
41
42
// +--------------------------------------------------------------------+
43
44
void
45
LoadScreen::Setup
(
Screen
* s)
46
{
47
if
(!s)
48
return
;
49
50
screen = s;
51
52
DataLoader
* loader =
DataLoader::GetLoader
();
53
loader->
UseFileSystem
(
true
);
54
55
// create windows
56
FormDef
load_def(
"LoadDlg"
, 0);
57
load_def.
Load
(
"LoadDlg"
);
58
load_dlg =
new
(__FILE__,__LINE__)
LoadDlg
(screen, load_def);
59
60
FormDef
cmp_load_def(
"CmpLoadDlg"
, 0);
61
cmp_load_def.
Load
(
"CmpLoadDlg"
);
62
cmp_load_dlg =
new
(__FILE__,__LINE__)
CmpLoadDlg
(screen, cmp_load_def);
63
64
loader->
UseFileSystem
(
Starshatter::UseFileSystem
());
65
ShowLoadDlg
();
66
}
67
68
// +--------------------------------------------------------------------+
69
70
void
71
LoadScreen::TearDown
()
72
{
73
if
(screen) {
74
if
(load_dlg) screen->
DelWindow
(load_dlg);
75
if
(cmp_load_dlg) screen->
DelWindow
(cmp_load_dlg);
76
}
77
78
delete
load_dlg;
79
delete
cmp_load_dlg;
80
81
load_dlg = 0;
82
cmp_load_dlg = 0;
83
screen = 0;
84
}
85
86
// +--------------------------------------------------------------------+
87
88
void
89
LoadScreen::ExecFrame
()
90
{
91
Game::SetScreenColor
(
Color::Black
);
92
93
if
(load_dlg && load_dlg->
IsShown
())
94
load_dlg->
ExecFrame
();
95
96
if
(cmp_load_dlg && cmp_load_dlg->
IsShown
())
97
cmp_load_dlg->
ExecFrame
();
98
}
99
100
// +--------------------------------------------------------------------+
101
102
bool
103
LoadScreen::CloseTopmost
()
104
{
105
return
false
;
106
}
107
108
void
109
LoadScreen::Show
()
110
{
111
if
(!isShown) {
112
ShowLoadDlg
();
113
isShown =
true
;
114
}
115
}
116
117
void
118
LoadScreen::Hide
()
119
{
120
if
(isShown) {
121
HideLoadDlg
();
122
isShown =
false
;
123
}
124
}
125
126
// +--------------------------------------------------------------------+
127
128
void
129
LoadScreen::ShowLoadDlg
()
130
{
131
if
(load_dlg) load_dlg->
Hide
();
132
if
(cmp_load_dlg) cmp_load_dlg->
Hide
();
133
134
Starshatter
* stars =
Starshatter::GetInstance
();
135
136
// show campaign load dialog if available and loading campaign
137
if
(stars && cmp_load_dlg) {
138
if
(stars->
GetGameMode
() ==
Starshatter::CLOD_MODE
||
139
stars->
GetGameMode
() ==
Starshatter::CMPN_MODE
) {
140
cmp_load_dlg->
Show
();
141
Mouse::Show
(
false
);
142
return
;
143
}
144
}
145
146
// otherwise, show regular load dialog
147
if
(load_dlg) {
148
load_dlg->
Show
();
149
Mouse::Show
(
false
);
150
}
151
}
152
153
// +--------------------------------------------------------------------+
154
155
void
156
LoadScreen::HideLoadDlg
()
157
{
158
if
(load_dlg && load_dlg->
IsShown
())
159
load_dlg->
Hide
();
160
161
if
(cmp_load_dlg && cmp_load_dlg->
IsShown
())
162
cmp_load_dlg->
Hide
();
163
}
Stars45
LoadScreen.cpp
Generated on Tue Jun 5 2012 20:46:55 for Starshatter_Open by
1.8.1