Well actually that was what I was thinking / deducing too, however:
.with_cursor(Cursor::Custom(custom_cursor))
results in expected `CustomCursor`, found `CustomCursorSource
And this .with_cursor(custom_cursor)
results in
the trait bound `winit::window::Cursor: From<CustomCursorSource>` is not satisfied
the following other types implement trait `From<T>`:
<winit::window::Cursor as From<CursorIcon>>
<winit::window::Cursor as From<CustomCursor>>
required for `CustomCursorSource` to implement `Into<winit::window::Cursor>`
The more information you provide when asking a question, the more likely you are to get a useful answer. In particular, if you've tried something and gotten errors, say so and include the error message.
CustomCursor::from_rgba tells you the return type is CustomCursorSource (which as you saw doesn't work), so follow that. There's no obvious way to get a CustomCursor, but there is a note that says " See CustomCursor for more details.", so go back to that.
Reading through the whole page (as opposed to just jumping to the method directly), you should see [an example of how to create a custom cursor]( See CustomCursor for more details.), which contains:
let custom_cursor = event_loop.create_custom_cursor(source);
window.set_cursor(custom_cursor.clone());
So the answer is: you create the cursor from the source via the event loop, then use the result of that with with_cursor. You just need to follow the links to find what you need, at least in this case.
As an aside: I have no idea why the code is structured like this. I can't think of any good reason for it, and frankly it's absolutely baffling.
Daniel, thank you very much.
I got - as a relative beginner - completely lost in the Into's CursorSource's, Cursor's, from_rgba's.
The Into<Cursor> made my brain panic!().
As an aside: I have no idea why the code is structured like this. I can't think of any good reason for it, and frankly it's absolutely baffling.
Into and From are used to define conversions between types. It's for conversions that cannot fail; if a conversion can fail, there is TryFrom and TryInto.