fn cycle_cursor_icon(
    input: Res<Input<MouseButton>>,
    mut windows: ResMut<Windows>,
    mut index: Local<usize>,
) {
    const ICONS: &[CursorIcon] = &[
        CursorIcon::Default,
        CursorIcon::Hand,
        CursorIcon::Wait,
        CursorIcon::Text,
        CursorIcon::Copy,
    ];
    let window = windows.get_primary_mut().unwrap();
    if input.just_pressed(MouseButton::Left) {
        *index = (*index + 1) % ICONS.len();
        window.set_cursor_icon(ICONS[*index]);
    } else if input.just_pressed(MouseButton::Right) {
        *index = if *index == 0 {
            ICONS.len() - 1
        } else {
            *index - 1
        };
        window.set_cursor_icon(ICONS[*index]);
    }
}
/// This system cycles the cursor's icon through a small set of icons when clicking
This system cycles the cursor's icon through a small set of icons when clicking
This system cycles the cursor ' s icon through a small set of icons when clicking
fn cycle_cursor_icon(
    input: Res<Input<MouseButton>>,
    mut windows: ResMut<Windows>,
    mut index: Local<usize>,
) {
    const ICONS: &[CursorIcon] = &[
        CursorIcon::Default,
        CursorIcon::Hand,
        CursorIcon::Wait,
        CursorIcon::Text,
        CursorIcon::Copy,
    ];
    let window = windows.get_primary_mut().unwrap();
    if input.just_pressed(MouseButton::Left) {
        *index = (*index + 1) % ICONS.len();
        window.set_cursor_icon(ICONS[*index]);
    } else if input.just_pressed(MouseButton::Right) {
        *index = if *index == 0 {
            ICONS.len() - 1
        } else {
            *index - 1
        };
        window.set_cursor_icon(ICONS[*index]);
    }
}
fn cycle_cursor_icon ( input : Res < Input < MouseButton > > , mut windows : ResMut < Windows > , mut index : Local < usize > , ) { const ICONS : & [ CursorIcon ] = & [ CursorIcon :: Default , CursorIcon :: Hand , CursorIcon :: Wait , CursorIcon :: Text , CursorIcon :: Copy , ] ; let window = windows . get_primary_mut ( ) . unwrap ( ) ; if input . just_pressed ( MouseButton :: Left ) { * index = ( * index + 1 ) % ICONS . len ( ) ; window . set_cursor_icon ( ICONS [ * index ] ) ; } else if input . just_pressed ( MouseButton :: Right ) { * index = if * index == 0 { ICONS . len ( ) - 1 } else { * index - 1 } ; window . set_cursor_icon ( ICONS [ * index ] ) ; } }
This system cycles the cursor's icon through a small set of icons when clicking
This system cycles the cursor ' s icon through a small set of icons when clicking
input
Res<Input<MouseButton>>
windows
ResMut<Windows>
index
Local<usize>
input
Res<Input<MouseButton>>
windows
ResMut<Windows>
index
Local<usize>