Skip to content

Commit

Permalink
Threshold, crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
evilC committed Mar 12, 2017
1 parent 53581e4 commit bc7389c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Plugins/Core/MouseToJoy.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class MouseToJoy extends _UCR.Classes.Plugin {
Description := "Converts mouse input delta information into two joystick axes"
RelativeScaleFactor := {x: 10, y: 10}
RelativeTimeout := 10
RelativeThreshold := 2
AbsoluteTimeout := {x: 10, y: 10}
AbsoluteScaleFactor := {x: 1, y: 1}
Mode := 2 ; 1 = Relative, 2 = Absolute
Expand All @@ -30,7 +31,7 @@ class MouseToJoy extends _UCR.Classes.Plugin {
this.AddControl("Edit", "RelativeTimeout", this.TimeoutChanged.Bind(this), "x120 w40 y" x_row - 10, 50)

Gui, Add, Text, % "x120 w40 center y" y_row - 10, Threshold
this.AddControl("Edit", "RelativeThreshold", this.TimeoutChanged.Bind(this, "X"), "x120 w40 y" y_row + 5, 2)
this.AddControl("Edit", "RelativeThreshold", this.RelativeThresholdChanged.Bind(this), "x120 w40 y" y_row + 5, 2)

this.AddControl("Edit", "RelativeScaleY", this.RelativeScaleChanged.Bind(this, "Y"), "x70 w30 y" y_row, 10)

Expand Down Expand Up @@ -94,7 +95,7 @@ class MouseToJoy extends _UCR.Classes.Plugin {

if (this.Mode = 1){
; Relative
threshold := this.GuiControls.RelativeThreshold.Get()
threshold := this.RelativeThreshold
if (dox && ax && ax <= threshold)
dox := 0
if (doy && ay && ay <= threshold)
Expand Down Expand Up @@ -181,6 +182,10 @@ class MouseToJoy extends _UCR.Classes.Plugin {
this.RelativeScaleFactor[axis] := value
}

RelativeThresholdChanged(value){
this.RelativeThreshold := value
}

TimeoutChanged(value){
this.RelativeTimeout := value
;this.MouseDelta.SetTimeOut(value)
Expand Down

0 comments on commit bc7389c

Please sign in to comment.