[PATCH 2/2] joy.cpl: Added POV axis visualization
Lucas Zawacki
lfzawacki at gmail.com
Tue Jun 26 22:09:51 CDT 2012
From: Lucas Zawacki <lfzawacki at gmail.com>
---
dlls/joy.cpl/joy.h | 3 ++-
dlls/joy.cpl/joy.rc | 1 +
dlls/joy.cpl/main.c | 29 +++++++++++++++++++++++++++--
3 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/dlls/joy.cpl/joy.h b/dlls/joy.cpl/joy.h
index c98f535..07c13fa 100644
--- a/dlls/joy.cpl/joy.h
+++ b/dlls/joy.cpl/joy.h
@@ -37,7 +37,7 @@ struct Joystick {
};
#define TEST_MAX_BUTTONS 32
-#define TEST_MAX_AXES 3
+#define TEST_MAX_AXES 4
struct JoystickData {
IDirectInput8W *di;
@@ -71,6 +71,7 @@ struct JoystickData {
#define IDC_TESTGROUPXY 2005
#define IDC_TESTGROUPRXRY 2006
#define IDC_TESTGROUPZRZ 2007
+#define IDC_TESTGROUPPOV 2008
#define IDC_JOYSTICKBUTTON 3000
#define IDC_JOYSTICKAXES 4000
diff --git a/dlls/joy.cpl/joy.rc b/dlls/joy.cpl/joy.rc
index 0636868..22d9253 100644
--- a/dlls/joy.cpl/joy.rc
+++ b/dlls/joy.cpl/joy.rc
@@ -51,6 +51,7 @@ FONT 8, "Ms Shell Dlg"
GROUPBOX "", IDC_TESTGROUPXY, 15, 30, 60, 60
GROUPBOX "", IDC_TESTGROUPRXRY, 92, 30, 60, 60
GROUPBOX "", IDC_TESTGROUPZRZ, 169, 30, 60, 60
+ GROUPBOX "", IDC_TESTGROUPPOV, 246, 30, 60, 60
}
IDD_FORCEFEEDBACK DIALOG 0, 0, 320, 220
diff --git a/dlls/joy.cpl/main.c b/dlls/joy.cpl/main.c
index 47894ca..eb8f982 100644
--- a/dlls/joy.cpl/main.c
+++ b/dlls/joy.cpl/main.c
@@ -212,6 +212,19 @@ static DWORD WINAPI input_thread(void *param)
DIJOYSTATE state;
struct JoystickData *data = param;
+ /* Setup POV as clock positions
+ * 0
+ * 31500 4500
+ * 27000 -1 9000
+ * 22500 13500
+ * 18000
+ */
+ int ma = TEST_AXIS_MAX;
+ int pov_val[9] = {0, 4500, 9000, 13500,
+ 18000, 22500, 27000, 31500, -1};
+ int pov_pos[9][2] = { {0, -ma}, {ma/2, -ma/2}, {ma, 0}, {ma/2, ma/2},
+ {0, ma}, {-ma/2, ma/2}, {-ma, 0}, {-ma/2, -ma/2}, {0, 0} };
+
ZeroMemory(&state, sizeof(state));
while (!data->stop)
@@ -234,6 +247,16 @@ static DWORD WINAPI input_thread(void *param)
axes_pos[2][0] = state.lZ;
axes_pos[2][1] = state.lRz;
+ /* Set pov values */
+ for (i = 0; i < sizeof(pov_val)/sizeof(pov_val[0]); i++)
+ {
+ if (state.rgdwPOV[0] == pov_val[i])
+ {
+ axes_pos[3][0] = pov_pos[i][0];
+ axes_pos[3][1] = pov_pos[i][1];
+ }
+ }
+
for (i = 0; i < TEST_MAX_AXES; i++)
SetWindowPos(data->axes[i], 0,
TEST_AXIS_X + TEST_NEXT_AXIS_X*i + axes_pos[i][0],
@@ -309,8 +332,10 @@ static void draw_joystick_axes(HWND hwnd, struct JoystickData* data)
DIPROPRANGE propRange;
HINSTANCE hinst = (HINSTANCE) GetWindowLongPtrW(hwnd, GWLP_HINSTANCE);
static const WCHAR button_class[] = {'B','u','t','t','o','n','\0'};
- static const WCHAR axes_names[TEST_MAX_AXES][7] = { {'X',',','Y','\0'}, {'R','x',',','R','y','\0'}, {'Z',',','R','z','\0'} };
- static const DWORD axes_idc[TEST_MAX_AXES] = { IDC_TESTGROUPXY, IDC_TESTGROUPRXRY, IDC_TESTGROUPZRZ };
+ static const WCHAR axes_names[TEST_MAX_AXES][7] = { {'X',',','Y','\0'}, {'R','x',',','R','y','\0'},
+ {'Z',',','R','z','\0'}, {'P','O','V','\0'} };
+ static const DWORD axes_idc[TEST_MAX_AXES] = { IDC_TESTGROUPXY, IDC_TESTGROUPRXRY,
+ IDC_TESTGROUPZRZ, IDC_TESTGROUPPOV };
/* Set axis range to ease the GUI visualization */
for (i = 0; i < data->num_joysticks; i++)
--
1.7.9.5
More information about the wine-patches
mailing list