#cursor #bevy #bevy-plugin #cur #ani #kit #animated

bevy_cursor_kit

A Bevy plugin for working with cursors

4 releases (2 breaking)

new 0.3.0 Jan 8, 2025
0.2.1 Jan 6, 2025
0.2.0 Jan 6, 2025
0.1.0 Jan 5, 2025

#340 in Game dev

Download history 340/week @ 2025-01-01

340 downloads per month

MIT/Apache

155KB
604 lines

Bevy cursor kit

Crates.io Docs.rs CI

Summary

Allows you to load .CUR and .ANI cursor files in your Bevy app and use them in custom CursorIcons.

  • .CUR files can be used for static cursor icons like a grabbing hand.
  • .ANI files can be used for animated cursor icons like an hourglass.

Quick start

Add the asset plugin for asset loader support:

use bevy_cursor_kit::prelude::*;

app.add_plugins(CursorAssetPlugin);

Load a static cursor or an animated cursor:

let handle = asset_server.load("example.CUR");

When the asset is ready, use its image when creating a custom CursorIcon component on your Windows:

let Some(cursor) = static_cursors.get(&handle) else {
  // ...
};

commands
  .entity(window)
  .insert(CursorIcon::Custom(CustomCursor::Image {
      handle: cursor.image.clone(),
      // Most .CUR are expected to only have one frame so just use index 0.
      hotspot: cursor.hotspot_or_default(0),
  }));

Check out the examples for more details.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~37–69MB
~1M SLoC