Skip to content

.CUR and .ANI cursor file support for Bevy

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

mgi388/bevy-cursor-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

.CUR and .ANI cursor file support for Bevy

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages