1 |
VERSION 1.0 CLASS |
2 |
BEGIN |
3 |
MultiUse = -1 'True |
4 |
Persistable = 0 'NotPersistable |
5 |
DataBindingBehavior = 0 'vbNone |
6 |
DataSourceBehavior = 0 'vbNone |
7 |
MTSTransactionMode = 0 'NotAnMTSObject |
8 |
END |
9 |
Attribute VB_Name = "Class_System" |
10 |
Attribute VB_GlobalNameSpace = False |
11 |
Attribute VB_Creatable = True |
12 |
Attribute VB_PredeclaredId = False |
13 |
Attribute VB_Exposed = False |
14 |
Option Explicit |
15 |
|
16 |
' --- public ---------------------------------------------------------------------------------------------- |
17 |
|
18 |
Public lDisplayWidth As Long |
19 |
Public lDisplayHeight As Long |
20 |
|
21 |
Public lDisplayDepthBit As Long |
22 |
|
23 |
Public lDisplayRefreshRate As Long |
24 |
|
25 |
' --- private -------------------------------------------------------------------------------------------- |
26 |
|
27 |
Private Type prvType_SystemCapabilities |
28 |
|
29 |
bSystem_DX8Initialised As Boolean |
30 |
bSystem_D3D8Initialised As Boolean |
31 |
bSystem_D3DX8Initialised As Boolean |
32 |
bSystem_DS8Initialised As Boolean |
33 |
bSystem_DS8Ready As Boolean |
34 |
|
35 |
End Type |
36 |
|
37 |
Private prvclDX8 As DirectX8 |
38 |
Private prvclD3D8 As Direct3D8 |
39 |
Private prvclD3DX8 As D3DX8 |
40 |
Private prvclDS8 As DirectSound8 |
41 |
|
42 |
Private prvtpPreferredDisplayMode As D3DDISPLAYMODE |
43 |
|
44 |
Private prvtpSystemCapabilities As prvType_SystemCapabilities |
45 |
' |
46 |
|
47 |
Public Property Get D3D8() As Direct3D8 |
48 |
|
49 |
Set D3D8 = prvclD3D8 |
50 |
|
51 |
End Property |
52 |
|
53 |
Public Property Get D3DX8() As D3DX8 |
54 |
|
55 |
Set D3DX8 = prvclD3DX8 |
56 |
|
57 |
End Property |
58 |
|
59 |
Public Property Get DS8() As DirectSound8 |
60 |
|
61 |
Set DS8 = prvclDS8 |
62 |
|
63 |
End Property |
64 |
|
65 |
Public Property Get DX8() As DirectX8 |
66 |
|
67 |
Set DX8 = prvclDX8 |
68 |
|
69 |
End Property |
70 |
|
71 |
Public Property Get DX8Initialised() As Boolean |
72 |
|
73 |
DX8Initialised = prvtpSystemCapabilities.bSystem_DX8Initialised |
74 |
|
75 |
End Property |
76 |
|
77 |
Public Function InitialiseD3D8() As Boolean |
78 |
|
79 |
On Local Error GoTo lblInitialiseFail |
80 |
|
81 |
Set prvclD3D8 = prvclDX8.Direct3DCreate() |
82 |
|
83 |
On Local Error GoTo 0 |
84 |
|
85 |
InitialiseD3D8 = True |
86 |
prvtpSystemCapabilities.bSystem_D3D8Initialised = True |
87 |
|
88 |
Exit Function |
89 |
|
90 |
lblInitialiseFail: |
91 |
|
92 |
On Local Error GoTo 0 |
93 |
|
94 |
End Function |
95 |
|
96 |
Public Function InitialiseD3DX8() As Boolean |
97 |
|
98 |
On Local Error GoTo lblInitialiseFail |
99 |
|
100 |
Set prvclD3DX8 = New D3DX8 |
101 |
|
102 |
On Local Error GoTo 0 |
103 |
|
104 |
InitialiseD3DX8 = True |
105 |
prvtpSystemCapabilities.bSystem_D3DX8Initialised = True |
106 |
|
107 |
Exit Function |
108 |
|
109 |
lblInitialiseFail: |
110 |
|
111 |
On Local Error GoTo 0 |
112 |
|
113 |
End Function |
114 |
|
115 |
Public Function InitialiseDS8() As Boolean |
116 |
|
117 |
On Local Error GoTo lblInitialiseFail |
118 |
|
119 |
Set prvclDS8 = prvclDX8.DirectSoundCreate("") |
120 |
|
121 |
On Local Error GoTo 0 |
122 |
|
123 |
InitialiseDS8 = True |
124 |
prvtpSystemCapabilities.bSystem_DS8Initialised = True |
125 |
|
126 |
Exit Function |
127 |
|
128 |
lblInitialiseFail: |
129 |
|
130 |
On Local Error GoTo 0 |
131 |
|
132 |
End Function |
133 |
|
134 |
Public Function DS8SetCooperativeLevel(lCooperativeFormhWnd As Long) As Boolean |
135 |
|
136 |
On Local Error GoTo lblInitialiseFail |
137 |
|
138 |
If prvtpSystemCapabilities.bSystem_DS8Initialised Then |
139 |
|
140 |
On Local Error GoTo lblInitialiseFail |
141 |
|
142 |
prvclDS8.SetCooperativeLevel lCooperativeFormhWnd, DSSCL_NORMAL |
143 |
' prvclDS8.SetCooperativeLevel lCooperativeFormhWnd, DSSCL_PRIORITY |
144 |
|
145 |
On Local Error GoTo 0 |
146 |
|
147 |
prvtpSystemCapabilities.bSystem_DS8Ready = True |
148 |
DS8SetCooperativeLevel = True |
149 |
|
150 |
End If |
151 |
|
152 |
Exit Function |
153 |
|
154 |
lblInitialiseFail: |
155 |
|
156 |
On Local Error GoTo 0 |
157 |
|
158 |
End Function |
159 |
|
160 |
Public Function InitialiseDX8() As Boolean |
161 |
|
162 |
On Local Error GoTo lblInitialiseFail |
163 |
|
164 |
Set prvclDX8 = New DirectX8 |
165 |
|
166 |
On Local Error GoTo 0 |
167 |
|
168 |
InitialiseDX8 = True |
169 |
prvtpSystemCapabilities.bSystem_DX8Initialised = True |
170 |
|
171 |
Exit Function |
172 |
|
173 |
lblInitialiseFail: |
174 |
|
175 |
On Local Error GoTo 0 |
176 |
|
177 |
End Function |