Starshatter_Open
Open source Starshatter engine
 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 
21 {
22  fullscreen_mode.width = 1024;
23  fullscreen_mode.height = 768;
26 
27  windowed_mode.width = 800;
28  windowed_mode.height = 600;
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 
47 { }
48 
49 // +--------------------------------------------------------------------+
50 
51 bool
53 {
54  return is_windowed;
55 }
56 
57 bool
59 {
60  return use_effects;
61 }
62 
63 int
65 {
66  if (is_windowed)
67  return window_width;
68 
69  return fullscreen_mode.width;
70 }
71 
72 int
74 {
75  if (is_windowed)
76  return window_height;
77 
78  return fullscreen_mode.height;
79 }
80 
81 int
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
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
129 {
130  if (is_windowed)
131  return windowed_mode.refresh;
132 
133  return fullscreen_mode.refresh;
134 }
135 
136 // +--------------------------------------------------------------------+
137 
138 const char*
140 {
141  if (is_windowed)
142  return windowed_mode.GetDescription();
143 
145 }
146 
147 // +--------------------------------------------------------------------+
148 
149 int
151 {
152  if (is_windowed)
154 
156 }
157 
158 int
160 {
161  if (is_windowed)
163 
165 }
166 
167 int
169 {
170  if (is_windowed)
172 
174 }
175 
176 int
178 {
179  if (is_windowed)
181 
183 }
184 
185 DWORD
187 {
188  if (is_windowed)
190 
192 }
193 
194 DWORD
196 {
197  if (is_windowed)
199 
201 }
202 
203 DWORD
205 {
206  if (is_windowed)
208 
210 }
211 
212 const char*
214 {
215  if (is_windowed)
217 
219 }
220 
221 const char*
223 {
224  if (is_windowed)
226 
228 }
229 
230 
231 // +--------------------------------------------------------------------+
232 // +--------------------------------------------------------------------+
233 // +--------------------------------------------------------------------+
234 
235 const char*
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 
259 {
260  ZeroMemory(this, sizeof(VideoDeviceInfo));
261 
263  depth_buffer_bits = 32;
264 }
265 
267 {
268 }