Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom cursors (images) #326

Open
PPakalns opened this issue Dec 1, 2024 · 1 comment
Open

Support custom cursors (images) #326

PPakalns opened this issue Dec 1, 2024 · 1 comment

Comments

@PPakalns
Copy link
Contributor

PPakalns commented Dec 1, 2024

Support overriding egui cursor default mapping to SystemCursorIcon with custom bevy_winit CursorIcon (e.g. Image)

@OwlyCode
Copy link

OwlyCode commented Dec 16, 2024

Best workaround I've found in the meantime is to have my own system run just after process_output_system:

// ...
.add_systems(PostUpdate, custom_cursor.after(process_output_system))
// ...

fn custom_cursor(mut primary_query: Query<&mut CursorIcon, With<PrimaryWindow>>, asset_server: Res<AssetServer>) {
    let Ok(mut cursor_icon) = primary_query.get_single_mut() else {
        return;
    };

    if let CursorIcon::System(_system_icon) = cursor_icon.as_ref() {
        *cursor_icon = CursorIcon::Custom(CustomCursor::Image {
            handle: asset_server.load("ui/arrow.png"),
            hotspot: (0, 0),
        });
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants