Skip to content

Commit

Permalink
Adds invert options to AxisSplitter
Browse files Browse the repository at this point in the history
  • Loading branch information
evilC committed Oct 23, 2017
1 parent 4c6012d commit a1732dc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Key:
0.1.18 - ???
= Increased number of Titan One axes to 13
TouchX and TouchY are now selectable.
+ Axis Splitter now has invert options for output axes

0.1.17 - 21st Aug 2017
= You can now properly bind Mouse Wheel
Expand Down
34 changes: 27 additions & 7 deletions Plugins/Core/AxisSplitter.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,53 @@ class AxisSplitter extends _UCR.Classes.Plugin {

Init(){
iow := 125
Gui, Add, GroupBox, Center xm ym w160 h110 section, Input Axis
Gui, Add, GroupBox, Center xm ym w160 h140 section, Input Axis
Gui, Add, Text, % "Center Section xs+5 ys+15 w" iow, Axis
this.AddControl("InputAxis", "IA1", 0, this.InputChangedState.Bind(this), "xs ys+15")
this.AddControl("AxisPreview", "", 0, this.IOControls.IA1, "xp y+10 w" iow, 50)

Gui, Add, GroupBox, Center x180 ym w270 h110 section, Output Axes
Gui, Add, GroupBox, Center x180 ym w270 h140 section, Output Axes
Gui, Add, Text, % "Center Section xs+5 ys+15 w" iow, Low
Gui, Add, Text, % "Center x+10 yp w" iow, High

this.AddControl("OutputAxis", "OA1", 0, "xs+5 ys+15")
this.AddControl("OutputAxis", "OA2", 0, "x+5 yp")
this.AddControl("CheckBox", "InvertL", this.InvertChanged.Bind(this, 1), "xs+5 y+10 w" iow, "Invert")
this.AddControl("CheckBox", "InvertH", this.InvertChanged.Bind(this, 2), "x+5 yp w" iow, "Invert")

this.AddControl("AxisPreview", "", 0, this.IOControls.OA1, "xs+5 y+10 w" iow, 50)
this.AddControl("AxisPreview", "", 0, this.IOControls.OA2, "x+5 yp w" iow, 50)

this.InvertState := [0,0]
}

InvertChanged(i, value){
this.InvertState[i] := value
this.InputChangedState(this.IOControls.IA1.Get())
}

InputChangedState(value){
value := UCR.Libraries.StickOps.AHKToInternal(value)
values := [0,0]
if (value < 0){
thisAxis := 1
otherAxis := 2
value *= -1
values[1] := UCR.Libraries.StickOps.InternalToAHK((value - 25) * 2)
values[2] := 0
} else if (value > 0){
values[1] := 0
values[2] := UCR.Libraries.StickOps.InternalToAHK((value - 25) * 2)
} else if (value > 0) {
thisAxis := 2
otherAxis := 1
}
values[thisAxis] := (value - 25) * 2
values[otherAxis] := -50
if (this.InvertState[thisAxis]){
values[thisAxis] *= -1
}
if (this.InvertState[otherAxis]){
values[otherAxis] *= -1
}
values[thisAxis] := UCR.Libraries.StickOps.InternalToAHK(values[thisAxis])
values[otherAxis] := UCR.Libraries.StickOps.InternalToAHK(values[otherAxis])

this.IOControls.OA1.Set(values[1])
this.IOControls.OA2.Set(values[2])
}
Expand Down

0 comments on commit a1732dc

Please sign in to comment.