Last active
November 26, 2015 07:51
-
-
Save michaelbartnett/95180424b798d923a67a to your computer and use it in GitHub Desktop.
quick script to generate all permutations of joystick number and axis index definitions for Unity3d's InputManager.asset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun print-joystick-axis-config (joynum axis-index) | |
| (let ((axis-def-fmt " - serializedVersion: 3 | |
| m_Name: Joystick_%i_Axis_%i | |
| descriptiveName: | |
| descriptiveNegativeName: | |
| negativeButton: | |
| positiveButton: | |
| altNegativeButton: | |
| altPositiveButton: | |
| gravity: 1000 | |
| dead: .00100000005 | |
| sensitivity: 1000 | |
| snap: 0 | |
| invert: 0 | |
| type: 2 | |
| axis: %i | |
| joyNum: %i | |
| ")) | |
| (princ (format axis-def-fmt joynum axis-index axis-index joynum)))) | |
| (loop for joynum from 1 to 11 | |
| do (loop for axis-index from 0 to 19 | |
| do (print-joystick-axis-config joynum axis-index))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (let ((num-joysticks 11) | |
| (num-axes 20)) | |
| (princ (format "\n public static string[][] JoystickAxes = new string[%i][] {\n" (* num-joysticks))) | |
| (loop for joynum from 1 to num-joysticks | |
| do | |
| (princ (format " new string[%i] {\n" num-axes)) | |
| (loop for axis-index from 0 to (- num-axes 1) | |
| do | |
| (princ (format " \"Joystick_%i_Axis_%i\",\n" joynum axis-index))) | |
| (princ " },\n")) | |
| (princ " };\n") | |
| nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment