Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
VideoFactory.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: VideoFac.cpp
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Video and Polygon Renderer Factory class
13 */
14 
15 #include "MemDebug.h"
16 #include "VideoFactory.h"
17 
18 #include "VideoDX9.h"
19 #include "SoundD3D.h"
20 
21 // +--------------------------------------------------------------------+
22 
24 : hwnd(h), video(0), audio(0)
25 { }
26 
28 { }
29 
30 // +--------------------------------------------------------------------+
31 
32 Video*
34 {
35  if (!video) {
36  video = (Video*) new(__FILE__,__LINE__) VideoDX9(hwnd, vs);
37 
38  if (!video) {
39  delete video;
40  video = 0;
41  }
42  }
43 
44  return video;
45 }
46 
47 // +--------------------------------------------------------------------+
48 
49 void
51 {
52  if (v == video) {
53  delete video;
54  video = 0;
55  }
56 }
57 
58 // +--------------------------------------------------------------------+
59 
60 SoundCard*
62 {
63  if (!audio) {
64  audio = new(__FILE__,__LINE__) SoundCardD3D(hwnd);
65  Sound::UseSoundCard(audio);
66  }
67 
68  return audio;
69 }
70 
71