00001 #ifndef INPUTHANDLER_DIRECTINPUT_HELPER_H 00002 #define INPUTHANDLER_DIRECTINPUT_HELPER_H 00003 00004 #include "InputFilter.h" 00005 00006 #define DIRECTINPUT_VERSION 0x0500 00007 #include <dinput.h> 00008 extern LPDIRECTINPUT dinput; 00009 00010 #define INPUT_QSIZE 32 00011 00012 typedef struct input_t 00013 { 00014 /* DirectInput offset for this input type: */ 00015 DWORD ofs; 00016 00017 /* Button, axis or hat: */ 00018 enum Type { KEY, BUTTON, AXIS, HAT } type; 00019 00020 int num; 00021 } input_t; 00022 00023 struct DIDevice 00024 { 00025 DIDEVICEINSTANCE JoystickInst; 00026 LPDIRECTINPUTDEVICE2 Device; 00027 00028 enum { KEYBOARD, JOYSTICK } type; 00029 00030 bool buffered; 00031 int buttons, axes, hats; 00032 vector<input_t> Inputs; 00033 InputDevice dev; 00034 00035 DIDevice(); 00036 00037 bool Open(); 00038 void Close(); 00039 }; 00040 00041 #endif 00042 00043 /* 00044 * (c) 2003-2004 Glenn Maynard 00045 * All rights reserved. 00046 * 00047 * Permission is hereby granted, free of charge, to any person obtaining a 00048 * copy of this software and associated documentation files (the 00049 * "Software"), to deal in the Software without restriction, including 00050 * without limitation the rights to use, copy, modify, merge, publish, 00051 * distribute, and/or sell copies of the Software, and to permit persons to 00052 * whom the Software is furnished to do so, provided that the above 00053 * copyright notice(s) and this permission notice appear in all copies of 00054 * the Software and that both the above copyright notice(s) and this 00055 * permission notice appear in supporting documentation. 00056 * 00057 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00058 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00059 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00060 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00061 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00062 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00063 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00064 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00065 * PERFORMANCE OF THIS SOFTWARE. 00066 */