CustomCursor::Image could use a custom size option
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
The new CustomCursor::Image solution in Bevy 0.15 is a great addition, making it simple to replace the cursor with an image instead of hiding the original cursor and making a Sprite follow its position.
```
commands
.entity(window_entity)
.insert(
CursorIcon::Custom(
CustomCursor::Image {
handle: asset_server.load("data/vanilla/sprites/kenney_hand.png").into(),
hotspot: (0, 0)
}
)
)
;
```
An advantage that the previous method had, however, was complete control about the image size, rotation, etc. In my current project, as an example, sprites are not represented with their original resolution, making the cursor look too small in comparison.
## What solution would you like?
An extra field in CustomCursor::Image allowing for the sprite to be stretched or shrinked.
## What alternative(s) have you considered?
A quick solution would be to modify the source file to make it bigger. This would mean however that using a different tileset with a different resolution would require making a new cursor as well, so their relative sizes keep being the same.
If one wanted to animate the cursor (making it grow when approaching something, or making it grow and shrink rhythmically) it would require making a cursor spritesheet, when changing the size value would be simpler.
Contributor guide
Research direction
Start by reading the existing CustomCursor::Image implementation and the Bevy 0.15 cursor example shown in the issue. Determine how a size option should interact with handle and hotspot, then verify that custom image cursors can be resized and that the requested behavior is covered by the relevant cursor tests or examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100