Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acgl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACGL
acgl
Commits
73665cff
Commit
73665cff
authored
Aug 08, 2014
by
Martin Schultz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added hack for analog trigger on windows of xbox 360 gamepad
parent
6fc9cc54
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
cmake
cmake
+1
-1
include/ACGL/HardwareSupport/GamePad.hh
include/ACGL/HardwareSupport/GamePad.hh
+5
-0
src/ACGL/HardwareSupport/GamePad.cc
src/ACGL/HardwareSupport/GamePad.cc
+10
-4
No files found.
cmake
@
a0eb0dda
Subproject commit
c4eead9bcb430fed3e99ee0df0f2b06559df5db4
Subproject commit
a0eb0dda91ce5d621d47de52bcecdd494b00e353
include/ACGL/HardwareSupport/GamePad.hh
View file @
73665cff
...
...
@@ -144,6 +144,11 @@ private:
bool
isMapped
(
GamePadButton
_button
);
void
printPressedButtonHelper
(
GamePadButton
_b
,
const
char
*
_TRUE
,
const
char
*
_false
);
//
// HACK for trigger mapping on windows of xbox 360 gamepad:
//
bool
isXBox360OnWindows
;
};
ACGL_SMARTPOINTER_TYPEDEFS
(
GamePad
)
...
...
src/ACGL/HardwareSupport/GamePad.cc
View file @
73665cff
...
...
@@ -40,6 +40,7 @@ GamePad::GamePad( int _n )
mMinSensitivity
=
0.0
f
;
mButtonState
=
NULL
;
mLastButtonState
=
NULL
;
isXBox360OnWindows
=
false
;
#if defined( ACGL_COMPILE_WITH_GLFW )
int
numberOfJoysticksFound
=
0
;
...
...
@@ -196,11 +197,8 @@ GamePad::GamePad( int _n )
setButtonMapping
(
LEFT_PAD_WEST
,
13
);
//setButtonMapping(LEFT_TRIGGER, 2 + mNumberOfButtons); // axis 2
//setButtonMapping(RIGHT_TRIGGER, 5 + mNumberOfButtons); // axis 5
isXBox360OnWindows
=
true
;
//setAxisMapping(LEFT_ANALOG_TRIGGER, 2); mAxesMultiplier[2] = 0.5f; mAxesAdd[2] = 0.5f;
//setAxisMapping(RIGHT_ANALOG_TRIGGER, 5); mAxesMultiplier[5] = -0.5f; mAxesAdd[5] = 0.5f;
setAxisMapping
(
LEFT_ANALOG_STICK_X
,
0
);
setAxisMapping
(
LEFT_ANALOG_STICK_Y
,
1
);
setAxisMapping
(
RIGHT_ANALOG_STICK_X
,
3
);
mAxesMultiplier
[
3
]
=
-
1.0
f
;
...
...
@@ -283,6 +281,14 @@ float GamePad::getAxisRaw( unsigned int _axis )
float
GamePad
::
getAxis
(
GamePadAxis
_axis
)
{
if
(
isXBox360OnWindows
)
{
if
(
_axis
==
GamePad
::
LEFT_ANALOG_TRIGGER
)
{
return
std
::
max
(
getAxisRaw
(
2
),
0.0
f
);
}
else
if
(
_axis
==
GamePad
::
RIGHT_ANALOG_TRIGGER
)
{
return
-
std
::
min
(
getAxisRaw
(
2
),
0.0
f
);
}
}
return
getAxisRaw
(
mAxisMap
[
_axis
]
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment