Marine systems simulation
Joystick.h
1#ifndef JOYSTICK_H
2#define JOYSTICK_H
3
4#include "myStruct.h"
5
6#define DIRECTINPUT_VERSION 0x0800
7#include <WS2tcpip.h>
8#include <WinSock2.h>
9#include <signal.h>
10#include <map>
11#define PORT "1503" // the port users will be connecting to
12
13#include <windows.h>
14#include <commctrl.h>
15#include <basetsd.h>
16#include <dinput.h>
17#include <dinputd.h>
18#include <assert.h>
19#include <oleauto.h>
20#include <shellapi.h>
21#include <wbemidl.h>
22
23
24#define IDI_MAIN 102
25#define IDD_JOYST_IMM 103
26#define IDR_ACCELERATOR1 103
27#define IDC_CLOSE 1001
28#define IDC_X_AXIS 1010
29#define IDC_Y_AXIS 1011
30#define IDC_Z_AXIS 1012
31#define IDC_X_AXIS_TEXT 1013
32#define IDC_Y_AXIS_TEXT 1014
33#define IDC_Z_AXIS_TEXT 1015
34#define IDC_X_ROT_TEXT 1016
35#define IDC_Y_ROT_TEXT 1017
36#define IDC_Z_ROT_TEXT 1018
37#define IDC_SLIDER0_TEXT 1019
38#define IDC_X_ROT 1020
39#define IDC_Y_ROT 1021
40#define IDC_Z_ROT 1022
41#define IDC_SLIDER1_TEXT 1023
42#define IDC_POV0_TEXT 1024
43#define IDC_POV1_TEXT 1025
44#define IDC_POV2_TEXT 1026
45#define IDC_POV3_TEXT 1027
46#define IDC_SLIDER0 1030
47#define IDC_SLIDER1 1031
48#define IDC_POV 1040
49#define IDC_POV0 1040
50#define IDC_BUTTONS 1041
51#define IDC_POV1 1042
52#define IDC_POV2 1043
53#define IDC_POV3 1044
54
55
56
57#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
58#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
59
60
61#pragma warning( disable : 4996 ) // disable deprecated warning
62#include <strsafe.h>
63#pragma warning( default : 4996 )
64
65//-----------------------------------------------------------------------------
66// Function-prototypes
67//-----------------------------------------------------------------------------
68INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
69BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext );
70BOOL CALLBACK EnumJoysticksCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
71HRESULT InitDirectInput( HWND hDlg );
72VOID FreeDirectInput();
73HRESULT UpdateInputState( HWND hDlg );
74HRESULT SetupForIsXInputDevice();
75bool IsXInputDevice( const GUID* pGuidProductFromDirectInput );
76void CleanupForIsXInputDevice();
77
78typedef struct {
79 LPDIRECTINPUTDEVICE8 dev;
80 myStruct data;
81
82} joyData_t;
83
84extern std::map<long long,joyData_t> Joysticks;
85
87{
88 DWORD dwVidPid;
89 XINPUT_DEVICE_NODE* pNext;
90};
91
92
93#endif
Definition: Joystick.h:87
Definition: Joystick.h:78
Definition: myStruct.h:5