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
Axes (like mice and joysticks) should have a high level api that don't require managing events directly (much like keyboard / mouse input events have a higher level Input<MouseButton> api).
It could look something like this:
fnsystem(joystick_axis:Res<Axis<JoystickId>>,window_axis:Res<Axis<WindowId>>){let x:Option<f32> = joystick_axis.x(joystick_id);let y:Option<f32> = joystick_axis.y(joystick_id);let xy:Option<Vec2> = joystick_axis.xy(joystick_id);// the legendary 3D joysticklet xyz:Option<Vec3> = joystick_axis.xyz(joystick_id);let cursor_position:Option<Vec2> = window_axis.xy(window_id);}
In this case, Some(result) is returned when that axis is available (device exists and value is a real number). Ex: if a cursor is not currently on a window, a joystick with the given id does not exist, or an xy joystick does not have a requested z-axis, none would be returned because there is no defined value.
The text was updated successfully, but these errors were encountered:
Why would the cursor_position axis be named WindowId? I understand it comes from the window, but if the only axis is the cursor wouldn't it be better to call it CursorId or something like that?
Is it because it would also include the mouse wheel axis?
This can be used to reduce the final binary size when a consumer only
needs WGSL support. I've enabled the feature by default for
backwards-compatibility
---------
Co-authored-by: robtfm <[email protected]>
Axes (like mice and joysticks) should have a high level api that don't require managing events directly (much like keyboard / mouse input events have a higher level
Input<MouseButton>
api).It could look something like this:
In this case,
Some(result)
is returned when that axis is available (device exists and value is a real number). Ex: if a cursor is not currently on a window, a joystick with the given id does not exist, or an xy joystick does not have a requested z-axis, none would be returned because there is no defined value.The text was updated successfully, but these errors were encountered: