Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 732 Bytes

mouse_icon.md

File metadata and controls

35 lines (25 loc) · 732 Bytes

Mouse Icon

We can change the mouse icon by the component Window.

use bevy::{
    app::{App, Startup},
    ecs::system::Query,
    window::{CursorIcon, Window},
    DefaultPlugins,
};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut windows: Query<&mut Window>) {
    let mut window = windows.single_mut();

    window.cursor.icon = CursorIcon::Hand;
}

We change the mouse icon by specifying window.cursor.icon.

Result:

Mouse Icon

➡️ Next: Engine Time

📘 Back: Table of contents