Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
funkeymonkey-pyrainput
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
packages
funkeymonkey-pyrainput
Commits
6c4bf4b3
Commit
6c4bf4b3
authored
Sep 24, 2017
by
sebt3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a joystick deadzone
parent
d03a7ef8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
README.md
README.md
+1
-0
pyrainput.cpp
pyrainput.cpp
+8
-4
No files found.
README.md
View file @
6c4bf4b3
...
...
@@ -26,6 +26,7 @@ mouse.sensitivity = 40
mouse.deadzone = 20
mouse.wheel.deadzone = 100
mouse.click.deadzone = 100
nubs.deadzone = 10
nubs.left.x = [*mouse_x*|mouse_y|mouse_btn|scroll_x|scroll_y]
nubs.left.y = [mouse_x|*mouse_y*|mouse_btn|scroll_x|scroll_y]
nubs.right.x = [mouse_x|mouse_y|*mouse_btn*|scroll_x|scroll_y]
...
...
pyrainput.cpp
View file @
6c4bf4b3
...
...
@@ -81,6 +81,7 @@ struct Settings {
NubClickMode
rightNubClickMode
=
MOUSE_RIGHT
;
// May be changed from any thread at any time
int
joyDeadzone
=
10
;
int
mouseDeadzone
=
20
;
int
mouseSensitivity
=
40
;
int
mouseWheelDeadzone
=
100
;
...
...
@@ -253,14 +254,14 @@ void handle(input_event const& e, unsigned int role) {
if
(
role
==
ROLE_LEFT_NUB
)
{
switch
(
e
.
code
)
{
case
ABS_X
:
if
(
global
.
settings
.
exportGamepad
)
{
if
(
global
.
settings
.
exportGamepad
&&
(
e
.
value
>
global
.
settings
.
joyDeadzone
||
e
.
value
<-
global
.
settings
.
joyDeadzone
)
)
{
global
.
gamepad
->
send
(
EV_ABS
,
ABS_X
,
e
.
value
);
global
.
gamepad
->
send
(
EV_SYN
,
0
,
0
);
}
handleNubAxis
(
global
.
settings
.
leftNubModeX
,
e
.
value
,
global
.
mouse
,
global
.
gamepad
,
global
.
settings
);
break
;
case
ABS_Y
:
if
(
global
.
settings
.
exportGamepad
)
{
if
(
global
.
settings
.
exportGamepad
&&
(
e
.
value
>
global
.
settings
.
joyDeadzone
||
e
.
value
<-
global
.
settings
.
joyDeadzone
)
)
{
global
.
gamepad
->
send
(
EV_ABS
,
ABS_Y
,
e
.
value
);
global
.
gamepad
->
send
(
EV_SYN
,
0
,
0
);
}
...
...
@@ -271,14 +272,14 @@ void handle(input_event const& e, unsigned int role) {
}
else
if
(
role
==
ROLE_RIGHT_NUB
)
{
switch
(
e
.
code
)
{
case
ABS_X
:
if
(
global
.
settings
.
exportGamepad
)
{
if
(
global
.
settings
.
exportGamepad
&&
(
e
.
value
>
global
.
settings
.
joyDeadzone
||
e
.
value
<-
global
.
settings
.
joyDeadzone
)
)
{
global
.
gamepad
->
send
(
EV_ABS
,
ABS_RX
,
e
.
value
);
global
.
gamepad
->
send
(
EV_SYN
,
0
,
0
);
}
handleNubAxis
(
global
.
settings
.
rightNubModeX
,
e
.
value
,
global
.
mouse
,
global
.
gamepad
,
global
.
settings
);
break
;
case
ABS_Y
:
if
(
global
.
settings
.
exportGamepad
)
{
if
(
global
.
settings
.
exportGamepad
&&
(
e
.
value
>
global
.
settings
.
joyDeadzone
||
e
.
value
<-
global
.
settings
.
joyDeadzone
)
)
{
global
.
gamepad
->
send
(
EV_ABS
,
ABS_RY
,
e
.
value
);
global
.
gamepad
->
send
(
EV_SYN
,
0
,
0
);
}
...
...
@@ -398,6 +399,9 @@ SettingHandlerMap const SETTING_HANDLERS = {
{
"mouse.click.deadzone"
,
[](
std
::
string
const
&
value
,
Settings
&
settings
)
{
settings
.
mouseClickDeadzone
=
std
::
stoi
(
value
);
}
},
{
"nubs.deadzone"
,
[](
std
::
string
const
&
value
,
Settings
&
settings
)
{
settings
.
joyDeadzone
=
std
::
stoi
(
value
);
}
},
{
"nubs.left.x"
,
[](
std
::
string
const
&
value
,
Settings
&
settings
)
{
settings
.
leftNubModeX
=
parseNubAxisMode
(
value
);
}
},
...
...
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