Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
VideoSettings.cpp
Go to the documentation of this file.
1
/* Project nGenEx
2
Destroyer Studios LLC
3
Copyright © 1997-2004. All Rights Reserved.
4
5
SUBSYSTEM: nGenEx.lib
6
FILE: VideoSettings.cpp
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Video Settings class implementation
13
*/
14
15
#include "
MemDebug.h
"
16
#include "
VideoSettings.h
"
17
18
// +--------------------------------------------------------------------+
19
20
VideoSettings::VideoSettings
()
21
{
22
fullscreen_mode
.
width
= 1024;
23
fullscreen_mode
.
height
= 768;
24
fullscreen_mode
.
refresh
= 75;
25
fullscreen_mode
.
format
=
VideoMode::FMT_X8R8G8B8
;
26
27
windowed_mode
.
width
= 800;
28
windowed_mode
.
height
= 600;
29
windowed_mode
.
refresh
= 0;
30
windowed_mode
.
format
=
VideoMode::FMT_NONE
;
31
32
window_width
= 800;
33
window_height
= 600;
34
35
is_windowed
=
false
;
36
use_effects
=
true
;
37
shadows
=
true
;
38
bumpmaps
=
true
;
39
specmaps
=
true
;
40
max_detail
= 4;
41
enable_vs
=
true
;
42
enable_ps
=
true
;
43
depth_bias
= 0;
44
}
45
46
VideoSettings::~VideoSettings
()
47
{ }
48
49
// +--------------------------------------------------------------------+
50
51
bool
52
VideoSettings::IsWindowed
()
const
53
{
54
return
is_windowed
;
55
}
56
57
bool
58
VideoSettings::UseEffects
()
const
59
{
60
return
use_effects
;
61
}
62
63
int
64
VideoSettings::GetWidth
()
const
65
{
66
if
(
is_windowed
)
67
return
window_width
;
68
69
return
fullscreen_mode
.
width
;
70
}
71
72
int
73
VideoSettings::GetHeight
()
const
74
{
75
if
(
is_windowed
)
76
return
window_height
;
77
78
return
fullscreen_mode
.
height
;
79
}
80
81
int
82
VideoSettings::GetDepth
()
const
83
{
84
int
fmt = 0;
85
int
bpp = 0;
86
87
if
(
is_windowed
)
88
fmt =
windowed_mode
.
format
;
89
else
90
fmt =
fullscreen_mode
.
format
;
91
92
switch
(fmt) {
93
default
:
94
case
VideoMode::FMT_NONE
: bpp = 0;
break
;
95
case
VideoMode::FMT_R5G5B5
: bpp = 15;
break
;
96
case
VideoMode::FMT_R5G6B5
: bpp = 16;
break
;
97
case
VideoMode::FMT_R8G8B8
: bpp = 24;
break
;
98
case
VideoMode::FMT_X8R8G8B8
: bpp = 32;
break
;
99
}
100
101
return
bpp;
102
}
103
104
int
105
VideoSettings::GetPixSize
()
const
106
{
107
int
fmt = 0;
108
int
pix = 0;
109
110
if
(
is_windowed
)
111
fmt =
windowed_mode
.
format
;
112
else
113
fmt =
fullscreen_mode
.
format
;
114
115
switch
(fmt) {
116
default
:
117
case
VideoMode::FMT_NONE
: pix = 0;
break
;
118
case
VideoMode::FMT_R5G5B5
: pix = 2;
break
;
119
case
VideoMode::FMT_R5G6B5
: pix = 2;
break
;
120
case
VideoMode::FMT_R8G8B8
: pix = 3;
break
;
121
case
VideoMode::FMT_X8R8G8B8
: pix = 4;
break
;
122
}
123
124
return
pix;
125
}
126
127
int
128
VideoSettings::GetRefreshRate
()
const
129
{
130
if
(
is_windowed
)
131
return
windowed_mode
.
refresh
;
132
133
return
fullscreen_mode
.
refresh
;
134
}
135
136
// +--------------------------------------------------------------------+
137
138
const
char
*
139
VideoSettings::GetModeDescription
()
const
140
{
141
if
(
is_windowed
)
142
return
windowed_mode
.
GetDescription
();
143
144
return
fullscreen_mode
.
GetDescription
();
145
}
146
147
// +--------------------------------------------------------------------+
148
149
int
150
VideoSettings::GetVertexProcessing
()
const
151
{
152
if
(
is_windowed
)
153
return
windowed_device
.
vertex_processing
;
154
155
return
fullscreen_device
.
vertex_processing
;
156
}
157
158
int
159
VideoSettings::GetDepthBufferBits
()
const
160
{
161
if
(
is_windowed
)
162
return
windowed_device
.
depth_buffer_bits
;
163
164
return
fullscreen_device
.
depth_buffer_bits
;
165
}
166
167
int
168
VideoSettings::GetAdapterIndex
()
const
169
{
170
if
(
is_windowed
)
171
return
windowed_device
.
adapter_index
;
172
173
return
fullscreen_device
.
adapter_index
;
174
}
175
176
int
177
VideoSettings::GetDeviceIndex
()
const
178
{
179
if
(
is_windowed
)
180
return
windowed_device
.
device_index
;
181
182
return
fullscreen_device
.
device_index
;
183
}
184
185
DWORD
186
VideoSettings::GetDeviceType
()
const
187
{
188
if
(
is_windowed
)
189
return
windowed_device
.
device_type
;
190
191
return
fullscreen_device
.
device_type
;
192
}
193
194
DWORD
195
VideoSettings::GetDepthStencilFormat
()
const
196
{
197
if
(
is_windowed
)
198
return
windowed_device
.
depth_stencil_format
;
199
200
return
fullscreen_device
.
depth_stencil_format
;
201
}
202
203
DWORD
204
VideoSettings::GetBackBufferFormat
()
const
205
{
206
if
(
is_windowed
)
207
return
windowed_device
.
back_buffer_format
;
208
209
return
fullscreen_device
.
back_buffer_format
;
210
}
211
212
const
char
*
213
VideoSettings::GetAdapterDesc
()
const
214
{
215
if
(
is_windowed
)
216
return
windowed_device
.
adapter_desc
;
217
218
return
fullscreen_device
.
adapter_desc
;
219
}
220
221
const
char
*
222
VideoSettings::GetDeviceDesc
()
const
223
{
224
if
(
is_windowed
)
225
return
windowed_device
.
device_desc
;
226
227
return
fullscreen_device
.
device_desc
;
228
}
229
230
231
// +--------------------------------------------------------------------+
232
// +--------------------------------------------------------------------+
233
// +--------------------------------------------------------------------+
234
235
const
char
*
236
VideoMode::GetDescription
()
const
237
{
238
static
char
desc[32];
239
240
int
bpp = 0;
241
switch
(
format
) {
242
default
:
243
case
VideoMode::FMT_NONE
: bpp = 0;
break
;
244
case
VideoMode::FMT_R5G5B5
: bpp = 15;
break
;
245
case
VideoMode::FMT_R5G6B5
: bpp = 16;
break
;
246
case
VideoMode::FMT_R8G8B8
: bpp = 24;
break
;
247
case
VideoMode::FMT_X8R8G8B8
: bpp = 32;
break
;
248
}
249
250
sprintf_s(desc,
"%d x %d x %d"
,
width
,
height
, bpp);
251
return
desc;
252
}
253
254
// +--------------------------------------------------------------------+
255
// +--------------------------------------------------------------------+
256
// +--------------------------------------------------------------------+
257
258
VideoDeviceInfo::VideoDeviceInfo
()
259
{
260
ZeroMemory(
this
,
sizeof
(
VideoDeviceInfo
));
261
262
vertex_processing
=
VideoSettings::VTX_HARDWARE
;
263
depth_buffer_bits
= 32;
264
}
265
266
VideoDeviceInfo::~VideoDeviceInfo
()
267
{
268
}
nGenEx
VideoSettings.cpp
Generated on Tue Jun 5 2012 20:46:42 for Starshatter_Open by
1.8.1