2016-03-18 11:36:04 +00:00
|
|
|
{{DISPLAYTITLE:_AXIS}}
|
2017-10-10 14:55:21 +00:00
|
|
|
The [[_AXIS]] function returns the relative position of a specified axis number on a controller device.
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{PageSyntax}}
|
2017-10-10 14:55:21 +00:00
|
|
|
: {{Parameter|move!}} = [[_AXIS]]({{Parameter|axis_number%}})
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
* [[SINGLE]] values returned range between -1 and 1 as maximums and 0 indicating minimum or axis center.
|
|
|
|
* When the mouse is moved on the program screen, moves left or above center are negative while below or right are positive.
|
|
|
|
* The ''axis_number'' must be a number which does not exceed the number of axis found by the [[_LASTAXIS]] function.
|
2017-10-10 14:55:21 +00:00
|
|
|
* '''The number of [[_DEVICES]] must be read before using [[_DEVICE$]], [[_DEVICEINPUT]] or [[_LASTAXIS]].'''
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
{{PageExamples}}
|
2015-08-02 12:12:44 +00:00
|
|
|
''Example:'' Reading multiple controller device buttons, axis and wheels.
|
|
|
|
{{CodeStart}} '' ''
|
|
|
|
{{Cl|FOR...NEXT|FOR}} i = 1 {{Cl|TO}} {{Cl|_DEVICES}}
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|PRINT}} {{Cl|STR$}}(i) + ") " + {{Cl|_DEVICE$}}(i) + " Buttons:"; {{Cl|_LASTBUTTON}}(i); ",Axis:"; {{Cl|_LASTAXIS}}(i); ",Wheel:"; {{Cl|_LASTWHEEL}}(i)
|
2015-08-02 12:12:44 +00:00
|
|
|
{{Cl|NEXT}}
|
|
|
|
|
|
|
|
{{Cl|DO...LOOP|DO}}
|
|
|
|
d& = {{Cl|_DEVICEINPUT}}
|
|
|
|
{{Cl|IF...THEN|IF}} d& {{Cl|THEN}} ' the device number cannot be zero!
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|PRINT}} "Found"; d&;
|
2015-08-02 12:12:44 +00:00
|
|
|
{{Cl|FOR...NEXT|FOR}} b = 1 {{Cl|TO}} {{Cl|_LASTBUTTON}}(d&)
|
|
|
|
{{Cl|PRINT}} {{Cl|_BUTTONCHANGE}}(b); {{Cl|_BUTTON}}(b);
|
|
|
|
{{Cl|NEXT}}
|
|
|
|
{{Cl|FOR...NEXT|FOR}} a = 1 {{Cl|TO}} {{Cl|_LASTAXIS}}(d&)
|
|
|
|
{{Cl|PRINT}} {{Cl|_AXIS}}(a);
|
|
|
|
{{Cl|NEXT}}
|
|
|
|
{{Cl|FOR...NEXT|FOR}} w = 1 {{Cl|TO}} {{Cl|_LASTWHEEL}}(d&)
|
|
|
|
{{Cl|PRINT}} {{Cl|_WHEEL}}(w);
|
|
|
|
{{Cl|NEXT}}
|
|
|
|
{{Cl|PRINT}}
|
|
|
|
{{Cl|END IF}}
|
|
|
|
{{Cl|LOOP}} {{Cl|UNTIL}} {{Cl|INKEY$}} = {{Cl|CHR$}}(27) 'escape key exit
|
|
|
|
|
|
|
|
{{Cl|END}} '' ''
|
|
|
|
{{CodeEnd}}
|
|
|
|
: ''Note:'' When there is no device control to read, a [[FOR...NEXT|FOR]] n = 1 TO 0 loop will not run thus avoiding a control function read error.
|
|
|
|
|
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
{{PageSeeAlso}}
|
2015-08-02 12:12:44 +00:00
|
|
|
* [[_LASTWHEEL]], [[_LASTBUTTON]], [[_LASTAXIS]]
|
|
|
|
* [[_WHEEL]], [[_BUTTON]], [[_BUTTONCHANGE]]
|
|
|
|
* [[_DEVICE$]], [[_DEVICES]]
|
|
|
|
* [[_MOUSEMOVEMENTX]], [[_MOUSEMOVEMENTY]] {{text|(relative movement)}}
|
|
|
|
* [[Controller Devices]]
|
|
|
|
|
|
|
|
|
2019-04-15 01:15:33 +00:00
|
|
|
{{PageNavigation}}
|