OSDN Git Service

92fa44cfcc1af6cf24ead7a7eef6196ba1f8ec04
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / directinput / JoystickState.h
1 /*\r
2 * Copyright (c) 2007-2010 SlimDX Group\r
3\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy\r
5 * of this software and associated documentation files (the "Software"), to deal\r
6 * in the Software without restriction, including without limitation the rights\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
8 * copies of the Software, and to permit persons to whom the Software is\r
9 * furnished to do so, subject to the following conditions:\r
10\r
11 * The above copyright notice and this permission notice shall be included in\r
12 * all copies or substantial portions of the Software.\r
13\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
20 * THE SOFTWARE.\r
21 */\r
22 #pragma once\r
23 \r
24 #include "Enums.h"\r
25 \r
26 namespace SlimDX\r
27 {\r
28         namespace DirectInput\r
29         {\r
30                 /// <summary>\r
31                 /// Describes the state of a joystick device.\r
32                 /// </summary>\r
33                 /// <unmanaged>DIJOYSTATE2</unmanaged>\r
34                 public ref class JoystickState\r
35                 {\r
36                 internal:\r
37                         unsigned int timeStamp;\r
38                         int x;\r
39                         int y;\r
40                         int z;\r
41                         int rx;\r
42                         int ry;\r
43                         int rz;\r
44                         array<int>^ sliders;\r
45                         array<int>^ povs;\r
46                         array<bool>^ pressedButtons;\r
47                         array<bool>^ releasedButtons;\r
48                         int vx;\r
49                         int vy;\r
50                         int vz;\r
51                         int vrx;\r
52                         int vry;\r
53                         int vrz;\r
54                         array<int>^ vsliders;\r
55                         int ax;\r
56                         int ay;\r
57                         int az;\r
58                         int arx;\r
59                         int ary;\r
60                         int arz;\r
61                         array<int>^ asliders;\r
62                         int fx;\r
63                         int fy;\r
64                         int fz;\r
65                         int frx;\r
66                         int fry;\r
67                         int frz;\r
68                         array<int>^ fsliders;\r
69 \r
70                         JoystickState( const DIJOYSTATE2 &joystate );\r
71 \r
72                 public:\r
73                         JoystickState();\r
74 \r
75                         /// <summary>\r
76                         /// \83^\83C\83\80\83X\83^\83\93\83v\82ð\95Ô\82·\81B\r
77                         /// </summary>\r
78                         property unsigned int TimeStamp\r
79                         {\r
80                                 unsigned int get() { return timeStamp; }\r
81                         }\r
82 \r
83                         /// <summary>\r
84                         /// Gets the state of each point-of-view controller on the joystick.\r
85                         /// </summary>\r
86                         array<int>^ GetPointOfViewControllers()\r
87                         {\r
88                                 return povs;\r
89                         }\r
90 \r
91                         /// <summary>\r
92                         /// Gets the position of each slider on the joystick.\r
93                         /// </summary>\r
94                         array<int>^ GetSliders()\r
95                         {\r
96                                 return sliders;\r
97                         }\r
98 \r
99                         /// <summary>\r
100                         /// Gets the velocity of each slider on the joystick.\r
101                         /// </summary>\r
102                         array<int>^ GetVelocitySliders()\r
103                         {\r
104                                 return vsliders;\r
105                         }\r
106 \r
107                         /// <summary>\r
108                         /// Gets the acceleration of each slider on the joystick.\r
109                         /// </summary>\r
110                         array<int>^ GetAccelerationSliders()\r
111                         {\r
112                                 return asliders;\r
113                         }\r
114 \r
115                         /// <summary>\r
116                         /// Gets the force of each slider on the joystick.\r
117                         /// </summary>\r
118                         array<int>^ GetForceSliders()\r
119                         {\r
120                                 return fsliders;\r
121                         }\r
122 \r
123                         /// <summary>\r
124                         /// Gets the state of each button on the joystick.\r
125                         /// </summary>\r
126                         array<bool>^ GetButtons()\r
127                         {\r
128                                 return pressedButtons;\r
129                         }\r
130 \r
131                         /// <summary>\r
132                         /// Gets the X-axis, usually the left-right movement of a stick.\r
133                         /// </summary>\r
134                         property int X\r
135                         {\r
136                                 int get() { return x; }\r
137                         }\r
138 \r
139                         /// <summary>\r
140                         /// Gets the Y-axis, usually the forward-backward movement of a stick.\r
141                         /// </summary>\r
142                         property int Y\r
143                         {\r
144                                 int get() { return y; }\r
145                         }\r
146 \r
147                         /// <summary>\r
148                         /// Gets the Z-axis, often the throttle control.\r
149                         /// </summary>\r
150                         property int Z\r
151                         {\r
152                                 int get() { return z; }\r
153                         }\r
154 \r
155                         /// <summary>\r
156                         /// Gets the X-axis rotation.\r
157                         /// </summary>\r
158                         property int RotationX\r
159                         {\r
160                                 int get() { return rx; }\r
161                         }\r
162 \r
163                         /// <summary>\r
164                         /// Gets the Y-axis rotation.\r
165                         /// </summary>\r
166                         property int RotationY\r
167                         {\r
168                                 int get() { return ry; }\r
169                         }\r
170 \r
171                         /// <summary>\r
172                         /// Gets the Z-axis rotation.\r
173                         /// </summary>\r
174                         property int RotationZ\r
175                         {\r
176                                 int get() { return rz; }\r
177                         }\r
178 \r
179                         /// <summary>\r
180                         /// Gets the X-axis velocity.\r
181                         /// </summary>\r
182                         property int VelocityX\r
183                         {\r
184                                 int get() { return vx; }\r
185                         }\r
186 \r
187                         /// <summary>\r
188                         /// Gets the Y-axis velocity.\r
189                         /// </summary>\r
190                         property int VelocityY\r
191                         {\r
192                                 int get() { return vy; }\r
193                         }\r
194 \r
195                         /// <summary>\r
196                         /// Gets the Z-axis velocity.\r
197                         /// </summary>\r
198                         property int VelocityZ\r
199                         {\r
200                                 int get() { return vz; }\r
201                         }\r
202 \r
203                         /// <summary>\r
204                         /// Gets the X-axis angular velocity.\r
205                         /// </summary>\r
206                         property int AngularVelocityX\r
207                         {\r
208                                 int get() { return vrx; }\r
209                         }\r
210 \r
211                         /// <summary>\r
212                         /// Gets the Y-axis angular velocity.\r
213                         /// </summary>\r
214                         property int AngularVelocityY\r
215                         {\r
216                                 int get() { return vry; }\r
217                         }\r
218 \r
219                         /// <summary>\r
220                         /// Gets the Z-axis angular velocity.\r
221                         /// </summary>\r
222                         property int AngularVelocityZ\r
223                         {\r
224                                 int get() { return vrz; }\r
225                         }\r
226 \r
227                         /// <summary>\r
228                         /// Gets the X-axis acceleration.\r
229                         /// </summary>\r
230                         property int AccelerationX\r
231                         {\r
232                                 int get() { return ax; }\r
233                         }\r
234 \r
235                         /// <summary>\r
236                         /// Gets the Y-axis acceleration.\r
237                         /// </summary>\r
238                         property int AccelerationY\r
239                         {\r
240                                 int get() { return ay; }\r
241                         }\r
242 \r
243                         /// <summary>\r
244                         /// Gets the Z-axis acceleration.\r
245                         /// </summary>\r
246                         property int AccelerationZ\r
247                         {\r
248                                 int get() { return az; }\r
249                         }\r
250 \r
251                         /// <summary>\r
252                         /// Gets the X-axis angular acceleration.\r
253                         /// </summary>\r
254                         property int AngularAccelerationX\r
255                         {\r
256                                 int get() { return arx; }\r
257                         }\r
258 \r
259                         /// <summary>\r
260                         /// Gets the Y-axis angular acceleration.\r
261                         /// </summary>\r
262                         property int AngularAccelerationY\r
263                         {\r
264                                 int get() { return ary; }\r
265                         }\r
266 \r
267                         /// <summary>\r
268                         /// Gets the Z-axis angular acceleration.\r
269                         /// </summary>\r
270                         property int AngularAccelerationZ\r
271                         {\r
272                                 int get() { return arz; }\r
273                         }\r
274 \r
275                         /// <summary>\r
276                         /// Gets the X-axis force.\r
277                         /// </summary>\r
278                         property int ForceX\r
279                         {\r
280                                 int get() { return fx; }\r
281                         }\r
282 \r
283                         /// <summary>\r
284                         /// Gets the Y-axis force.\r
285                         /// </summary>\r
286                         property int ForceY\r
287                         {\r
288                                 int get() { return fy; }\r
289                         }\r
290 \r
291                         /// <summary>\r
292                         /// Gets the Z-axis force.\r
293                         /// </summary>\r
294                         property int ForceZ\r
295                         {\r
296                                 int get() { return fz; }\r
297                         }\r
298 \r
299                         /// <summary>\r
300                         /// Gets the X-axis torque.\r
301                         /// </summary>\r
302                         property int TorqueX\r
303                         {\r
304                                 int get() { return frx; }\r
305                         }\r
306 \r
307                         /// <summary>\r
308                         /// Gets the Y-axis torque.\r
309                         /// </summary>\r
310                         property int TorqueY\r
311                         {\r
312                                 int get() { return fry; }\r
313                         }\r
314 \r
315                         /// <summary>\r
316                         /// Gets the Z-axis torque.\r
317                         /// </summary>\r
318                         property int TorqueZ\r
319                         {\r
320                                 int get() { return frz; }\r
321                         }\r
322 \r
323                         bool IsPressed( int button ) { return pressedButtons[button]; }\r
324                         bool IsReleased( int button ) { return releasedButtons[button]; }\r
325 \r
326                 internal:\r
327                         void AssignState( const DIJOYSTATE2 &joystate );\r
328                 };\r
329         }\r
330 }\r