From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- .../html/_n_p_client_wraps_8cpp_source.html | 366 +++++++++++++++++++++ 1 file changed, 366 insertions(+) create mode 100644 Doc/doxygen/html/_n_p_client_wraps_8cpp_source.html (limited to 'Doc/doxygen/html/_n_p_client_wraps_8cpp_source.html') diff --git a/Doc/doxygen/html/_n_p_client_wraps_8cpp_source.html b/Doc/doxygen/html/_n_p_client_wraps_8cpp_source.html new file mode 100644 index 0000000..83cd56f --- /dev/null +++ b/Doc/doxygen/html/_n_p_client_wraps_8cpp_source.html @@ -0,0 +1,366 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/NPClientWraps.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
NPClientWraps.cpp
+
+
+Go to the documentation of this file.
1 // *******************************************************************************
+
2 // *
+
3 // * Module Name:
+
4 // * NPClientWraps.cpp
+
5 // *
+
6 // * Software Engineer:
+
7 // * Doyle Nickless - GoFlight Inc., for Eye Control Technology.
+
8 // *
+
9 // * Abstract:
+
10 // * This module implements the wrapper code for interfacing to the NaturalPoint
+
11 // * Game Client API. Developers of client apps can include this module into
+
12 // * their projects to simplify communication with the NaturalPoint software.
+
13 // *
+
14 // * This is necessary since the NPClient DLL is run-time linked rather than
+
15 // * load-time linked, avoiding the need to link a static library into the
+
16 // * client program (only this module is needed, and can be supplied in source
+
17 // * form.)
+
18 // *
+
19 // * Environment:
+
20 // * User mode
+
21 // *
+
22 // *******************************************************************************
+
23 //
+
24 #include "MemDebug.h"
+
25 #include "Game.h"
+
26 #include "Text.h"
+
27 
+
28 #include "NPClient.h"
+
29 #include "NPClientWraps.h"
+
30 
+
32 // Defines ///////////////////////////////////////////////////////////////////////
+
34 //
+
35 
+
37 // Global Data ///////////////////////////////////////////////////////////////////
+
39 //
+ + + + + + + + + + + + +
52 
+
53 HMODULE ghNPClientDLL = (HMODULE)NULL;
+
54 
+
56 // NaturalPoint Game Client API function wrappers /////////////////////////////
+
58 //
+
59 NPRESULT __stdcall NP_RegisterWindowHandle( HWND hWnd )
+
60 {
+ +
62 
+
63  if( NULL != gpfNP_RegisterWindowHandle )
+
64  result = (*gpfNP_RegisterWindowHandle)( hWnd );
+
65 
+
66  return result;
+
67 } // NP_RegisterWindowHandle()
+
68 
+
69 
+ +
71 {
+ +
73 
+
74  if( NULL != gpfNP_UnregisterWindowHandle )
+
75  result = (*gpfNP_UnregisterWindowHandle)();
+
76 
+
77  return result;
+
78 } // NP_UnregisterWindowHandle()
+
79 
+
80 
+
81 NPRESULT __stdcall NP_RegisterProgramProfileID( unsigned short wPPID )
+
82 {
+ +
84 
+
85  if( NULL != gpfNP_RegisterProgramProfileID )
+
86  result = (*gpfNP_RegisterProgramProfileID)( wPPID );
+
87 
+
88  return result;
+
89 } // NP_RegisterProgramProfileID()
+
90 
+
91 
+
92 NPRESULT __stdcall NP_QueryVersion( unsigned short* pwVersion )
+
93 {
+ +
95 
+
96  if( NULL != gpfNP_QueryVersion )
+
97  result = (*gpfNP_QueryVersion)( pwVersion );
+
98 
+
99  return result;
+
100 } // NP_QueryVersion()
+
101 
+
102 
+
103 NPRESULT __stdcall NP_RequestData( unsigned short wDataReq )
+
104 {
+ +
106 
+
107  if( NULL != gpfNP_RequestData )
+
108  result = (*gpfNP_RequestData)( wDataReq );
+
109 
+
110  return result;
+
111 } // NP_RequestData()
+
112 
+ +
114 {
+ +
116 
+
117  if( NULL != gpfNP_GetSignature )
+
118  result = (*gpfNP_GetSignature)( pSignature );
+
119 
+
120  return result;
+
121 } // NP_GetSignature()
+
122 
+
123 
+ +
125 {
+ +
127 
+
128  if( NULL != gpfNP_GetData )
+
129  result = (*gpfNP_GetData)( pTID );
+
130 
+
131  return result;
+
132 } // NP_GetData()
+
133 
+
134 
+ +
136 {
+ +
138 
+
139  if( NULL != gpfNP_StartCursor )
+
140  result = (*gpfNP_StartCursor)();
+
141 
+
142  return result;
+
143 } // NP_StartCursor()
+
144 
+
145 
+ +
147 {
+ +
149 
+
150  if( NULL != gpfNP_StopCursor )
+
151  result = (*gpfNP_StopCursor)();
+
152 
+
153  return result;
+
154 } // NP_StopCursor()
+
155 
+
156 
+ +
158 {
+ +
160 
+
161  if( NULL != gpfNP_ReCenter )
+
162  result = (*gpfNP_ReCenter)();
+
163 
+
164  return result;
+
165 } // NP_ReCenter()
+
166 
+
167 
+ +
169 {
+ +
171 
+
172  if( NULL != gpfNP_StartDataTransmission )
+
173  result = (*gpfNP_StartDataTransmission)();
+
174 
+
175  return result;
+
176 } // NP_StartDataTransmission()
+
177 
+
178 
+ +
180 {
+ +
182 
+
183  if( NULL != gpfNP_StopDataTransmission )
+
184  result = (*gpfNP_StopDataTransmission)();
+
185 
+
186  return result;
+
187 } // NP_StopDataTransmission()
+
188 
+
189 
+
191 // NPClientInit() -- Loads the DLL and retrieves pointers to all exports
+
192 //
+
193 NPRESULT NPClient_Init( const char* csDLLPath )
+
194 {
+
195  NPRESULT result = NP_OK;
+
196 
+
197  Text csNPClientDLLFullPath;
+
198 
+
199  if (csDLLPath && *csDLLPath)
+
200  csNPClientDLLFullPath = Text(csDLLPath) + "\\";
+
201  csNPClientDLLFullPath += "NPClient.dll";
+
202 
+
203  ghNPClientDLL = ::LoadLibrary( csNPClientDLLFullPath.data() );
+
204 
+
205  if (NULL != ghNPClientDLL) {
+
206  // verify the dll signature
+
207  gpfNP_GetSignature = (PF_NP_GETSIGNATURE)::GetProcAddress( ghNPClientDLL, "NP_GetSignature" );
+
208 
+
209  SIGNATUREDATA pSignature;
+
210  SIGNATUREDATA verifySignature;
+
211  // init the signatures
+
212  strcpy_s(verifySignature.DllSignature, "precise head tracking\n put your head into the game\n now go look around\n\n Copyright EyeControl Technologies");
+
213  strcpy_s(verifySignature.AppSignature, "hardware camera\n software processing data\n track user movement\n\n Copyright EyeControl Technologies");
+
214  // query the dll and compare the results
+
215  NPRESULT vresult = NP_GetSignature( &pSignature );
+
216  if( vresult == NP_OK )
+
217  {
+
218  if ((strcmp(verifySignature.DllSignature,pSignature.DllSignature)==0)
+
219  && (strcmp(verifySignature.AppSignature,pSignature.AppSignature)==0))
+
220  {
+
221  result = NP_OK;
+
222 
+
223  // Get addresses of all exported functions
+
224  gpfNP_RegisterWindowHandle = (PF_NP_REGISTERWINDOWHANDLE)::GetProcAddress( ghNPClientDLL, "NP_RegisterWindowHandle" );
+
225  gpfNP_UnregisterWindowHandle = (PF_NP_UNREGISTERWINDOWHANDLE)::GetProcAddress( ghNPClientDLL, "NP_UnregisterWindowHandle" );
+
226  gpfNP_RegisterProgramProfileID = (PF_NP_REGISTERPROGRAMPROFILEID)::GetProcAddress( ghNPClientDLL, "NP_RegisterProgramProfileID" );
+
227  gpfNP_QueryVersion = (PF_NP_QUERYVERSION)::GetProcAddress( ghNPClientDLL, "NP_QueryVersion" );
+
228  gpfNP_RequestData = (PF_NP_REQUESTDATA)::GetProcAddress( ghNPClientDLL, "NP_RequestData" );
+
229  gpfNP_GetData = (PF_NP_GETDATA)::GetProcAddress( ghNPClientDLL, "NP_GetData" );
+
230  gpfNP_StartCursor = (PF_NP_STARTCURSOR)::GetProcAddress( ghNPClientDLL, "NP_StartCursor" );
+
231  gpfNP_StopCursor = (PF_NP_STOPCURSOR)::GetProcAddress( ghNPClientDLL, "NP_StopCursor" );
+
232  gpfNP_ReCenter = (PF_NP_RECENTER)::GetProcAddress( ghNPClientDLL, "NP_ReCenter" );
+
233  gpfNP_StartDataTransmission = (PF_NP_STARTDATATRANSMISSION)::GetProcAddress( ghNPClientDLL, "NP_StartDataTransmission" );
+
234  gpfNP_StopDataTransmission = (PF_NP_STOPDATATRANSMISSION)::GetProcAddress( ghNPClientDLL, "NP_StopDataTransmission" );
+
235  }
+
236  else
+
237  {
+
238  result = NP_ERR_DLL_NOT_FOUND;
+
239  }
+
240  }
+
241  else
+
242  {
+
243  result = NP_ERR_DLL_NOT_FOUND;
+
244  }
+
245  }
+
246  else
+
247  result = NP_ERR_DLL_NOT_FOUND;
+
248 
+
249  return result;
+
250 
+
251 } // NPClient_Init()
+
252 
+
254 
+
255 
+
256 
+
257 
+
+
+ + + + -- cgit v1.1