You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can read a litter more about how to install an aar library [here](https://developer.android.com/studio/projects/android-library#psd-add-aar-jar-dependency)
@@ -170,10 +170,25 @@ And use it.
170
170
```kotlin
171
171
// ....
172
172
val joystick = findViewById<JoystickView>(R.id.vJoystick)
173
-
joystick.setMoveListener {
174
173
174
+
// listener for moving
175
+
joystick.setMoveStartListener { direction ->
176
+
// Do something when the user starts to move (tap down) the joystick
177
+
}
178
+
joystick.setMoveListener { direction ->
179
+
// Do something when the user moves (or hold down) the joystick
180
+
}
181
+
joystick.setMoveEndListener {
182
+
// Do something when the user stops moving (tap up) the joystick
183
+
}
184
+
185
+
// force the joystick to move
186
+
btnExample.setOnClickListener {
187
+
// to specific a direction
188
+
joystick.move(Control.Direction.UP, 1f) // direction and intensity (0f to 1f)
189
+
// to specific position
190
+
joystick.move(200, 200)
175
191
}
176
-
// ....
177
192
```
178
193
179
194
### Usage customization
@@ -186,26 +201,28 @@ If you use the JoystickView view in a layout (xml), you could place values to so
186
201
***moveInterval**
187
202
188
203
It is an interval (integer) of time (ms) for which passed, to consider the touch on the joystick as maintained.
189
-
For now, it has a bad name, it will be changed in future versions.
190
204
***invalidRadius**
191
205
192
-
It is a dimension value to be taken into account when obtaining control direction.
206
+
It is a dimension value to be consider a dead zone when obtaining control direction.
193
207
In other words, if the distance between the touch made by the user and the center of the JoystickView does not exceed this value,
194
208
the joystick direction is considered as NONE.
195
209
196
210
***controlType**
197
211
198
-
It is an enum that determines that the already defined ControlDrawer will be used as the initial drawer of the joystick.
212
+
It is an enumeration that determines that the already defined Drawer will be used as the joystick's initial setting.
199
213
For now, it can be any of the following values:
200
214
* arc
201
215
202
-
The drawer to be used will be CircleControlDrawer
216
+
The drawer to be used will be CircleDrawer
203
217
* arc
204
218
205
-
The drawer to be used will be ArcControlDrawer
219
+
The drawer to be used will be ArcDrawer
206
220
* circe_arc
207
221
208
-
The drawer to be used will be CircleArcControlDrawer
222
+
The drawer to be used will be CircleArcDrawer
223
+
* wedge
224
+
225
+
The drawer to be used will be WedgeDrawer
209
226
210
227
***directionType**
211
228
It is an enum that determines how many directions the joystick will be able to pass to its listener.
@@ -245,7 +262,7 @@ To see how the joystick looks like with different configurations you could clone
245
262
and run the application, but if you don't want to do that, here is a video that will show you how it looks like with some configuration changes.
0 commit comments