summaryrefslogtreecommitdiffhomepage
path: root/Stars45/Joystick.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/Joystick.cpp')
-rw-r--r--Stars45/Joystick.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/Stars45/Joystick.cpp b/Stars45/Joystick.cpp
index 5a30f8d..9693c9d 100644
--- a/Stars45/Joystick.cpp
+++ b/Stars45/Joystick.cpp
@@ -112,11 +112,11 @@ Joystick::Joystick()
else if (!pdi) {
HRESULT hr = DirectInput8Create(Game::GetHINST(),
- DIRECTINPUT_VERSION,
- IID_IDirectInput7,
+ DIRECTINPUT_VERSION,
+ IID_IDirectInput7,
(void**)&pdi,
- NULL);
- if FAILED(hr) {
+ NULL);
+ if FAILED(hr) {
DirectInputError("Failed to initialize DI7", hr);
pdi = 0;
pdev = 0;
@@ -232,7 +232,7 @@ Joystick::MapKeys(KeyMapEntry* mapping, int nkeys)
static inline double sqr(double a) { return a*a; }
-BOOL FAR PASCAL EnumJoystick(LPCDIDEVICEINSTANCE pdinst, LPVOID pvSelect)
+BOOL FAR PASCAL EnumJoystick(LPCDIDEVICEINSTANCE pdinst, LPVOID pvSelect)
{
CopyMemory(&devices[ndev++], pdinst, pdinst->dwSize);
@@ -273,14 +273,14 @@ bool CreateDevice(int select)
HRESULT hr = DI_OK;
// Create the DirectInput joystick device:
- hr = pdi->CreateDeviceEx(pdinst->guidInstance,
- IID_IDirectInputDevice7,
- (void**)&pdev,
+ hr = pdi->CreateDeviceEx(pdinst->guidInstance,
+ IID_IDirectInputDevice7,
+ (void**)&pdev,
NULL);
- if (hr != DI_OK || pdev == 0) {
+ if (hr != DI_OK || pdev == 0) {
DirectInputError("Create Device Ex failed", hr);
- return false;
+ return false;
}
// Set the data format:
@@ -296,14 +296,14 @@ bool CreateDevice(int select)
// Set the coop level:
hr = pdev->SetCooperativeLevel(Game::GetHWND(), DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
- if (hr != DI_OK) {
- DirectInputError("Set Cooperative Level failed", hr);
- pdev->Release();
- return false;
+ if (hr != DI_OK) {
+ DirectInputError("Set Cooperative Level failed", hr);
+ pdev->Release();
+ return false;
}
// Set data ranges
- DIPROPRANGE diprg;
+ DIPROPRANGE diprg;
diprg.lMin = -32768;
diprg.lMax = +32768;
@@ -351,10 +351,10 @@ Joystick::EnumerateDevices()
Print("Joystick: preparing to enumerate devices\n");
ndev = 0;
- HRESULT hr =
+ HRESULT hr =
pdi->EnumDevices(DI8DEVTYPE_JOYSTICK,
EnumJoystick,
- (LPVOID) 0,
+ (LPVOID) 0,
DIEDFL_ATTACHEDONLY);
if (FAILED(hr)) {
@@ -556,7 +556,7 @@ Joystick::Acquire()
return;
//============================================================
- //
+ //
// FIRST TRY DIRECT INPUT
bool acquired = false;
@@ -617,7 +617,7 @@ Joystick::Acquire()
}
//============================================================
- //
+ //
// THEN TRY WINDOWS MULTIMEDIA LIBRARY
if (!acquired) {
@@ -791,7 +791,7 @@ bool Joystick::KeyDown(int key)
{
if (!joystick)
return false;
-
+
if (key >= KEY_JOY_1 && key <= KEY_JOY_32)
return joystick->action[key - KEY_JOY_1];
@@ -872,7 +872,7 @@ const char* DIErrStr(HRESULT hr)
return "The device buffer overflowed and some input was lost. This value is equal to the S_FALSE standard COM return value.";
case DI_DOWNLOADSKIPPED:
return "The parameters of the effect were successfully updated, but the effect could not be downloaded because the associated device was not acquired in exclusive mode.";
- case DI_EFFECTRESTARTED:
+ case DI_EFFECTRESTARTED:
return "The effect was stopped, the parameters were updated, and the effect was restarted.";
case DI_POLLEDDEVICE:
return "The device is a polled device. As a result, device buffering does not collect any data and event notifications is not signaled until the IDirectInputDevice7::Poll method is called.";