diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /platform/windows/joypad.h | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf180.tar.gz godot-5dbf180.tar.zst godot-5dbf180.zip | |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'platform/windows/joypad.h')
| -rw-r--r-- | platform/windows/joypad.h | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/platform/windows/joypad.h b/platform/windows/joypad.h index d6670c90d..7e4f6ff32 100644 --- a/platform/windows/joypad.h +++ b/platform/windows/joypad.h @@ -34,30 +34,28 @@ #include <dinput.h> #include <xinput.h> // on unix the file is called "xinput.h", on windows I'm sure it won't mind -#ifndef SAFE_RELEASE // when Windows Media Device M? is not present +#ifndef SAFE_RELEASE // when Windows Media Device M? is not present #define SAFE_RELEASE(x) \ -if(x != NULL) \ -{ \ - x->Release(); \ - x = NULL; \ -} + if (x != NULL) { \ + x->Release(); \ + x = NULL; \ + } #endif #ifndef XUSER_MAX_COUNT #define XUSER_MAX_COUNT 4 #endif -class JoypadWindows -{ +class JoypadWindows { public: JoypadWindows(); - JoypadWindows(InputDefault* _input, HWND* hwnd); + JoypadWindows(InputDefault *_input, HWND *hwnd); ~JoypadWindows(); void probe_joypads(); unsigned int process_joypads(unsigned int p_last_id); -private: +private: enum { JOYPADS_MAX = 16, JOY_AXIS_COUNT = 6, @@ -110,13 +108,13 @@ private: } }; - typedef DWORD (WINAPI *XInputGetState_t) (DWORD dwUserIndex, XINPUT_STATE* pState); - typedef DWORD (WINAPI *XInputSetState_t) (DWORD dwUserIndex, XINPUT_VIBRATION* pVibration); + typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex, XINPUT_STATE *pState); + typedef DWORD(WINAPI *XInputSetState_t)(DWORD dwUserIndex, XINPUT_VIBRATION *pVibration); - HWND* hWnd; + HWND *hWnd; HANDLE xinput_dll; LPDIRECTINPUT8 dinput; - InputDefault* input; + InputDefault *input; int id_to_change; int joypad_count; @@ -124,10 +122,10 @@ private: dinput_gamepad d_joypads[JOYPADS_MAX]; xinput_gamepad x_joypads[XUSER_MAX_COUNT]; - static BOOL CALLBACK enumCallback(const DIDEVICEINSTANCE* p_instance, void* p_context); - static BOOL CALLBACK objectsCallback(const DIDEVICEOBJECTINSTANCE* instance, void* context); + static BOOL CALLBACK enumCallback(const DIDEVICEINSTANCE *p_instance, void *p_context); + static BOOL CALLBACK objectsCallback(const DIDEVICEOBJECTINSTANCE *instance, void *context); - void setup_joypad_object(const DIDEVICEOBJECTINSTANCE* ob, int p_joy_id); + void setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_joy_id); void close_joypad(int id = -1); void load_xinput(); void unload_xinput(); @@ -135,8 +133,8 @@ private: unsigned int post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad); bool have_device(const GUID &p_guid); - bool is_xinput_device(const GUID* p_guid); - bool setup_dinput_joypad(const DIDEVICEINSTANCE* instance); + bool is_xinput_device(const GUID *p_guid); + bool setup_dinput_joypad(const DIDEVICEINSTANCE *instance); void joypad_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp); void joypad_vibration_stop_xinput(int p_device, uint64_t p_timestamp); @@ -146,5 +144,3 @@ private: }; #endif - - |
