Merge Window::set_cursor_icon() and Window::set_custom_cursor() (#3308)
This commit is contained in:
parent
34dd2cdba9
commit
be4a660011
17 changed files with 165 additions and 159 deletions
|
|
@ -31,7 +31,7 @@ fn main() -> Result<(), impl std::error::Error> {
|
|||
..
|
||||
} => {
|
||||
println!("Setting cursor to \"{:?}\"", CURSORS[cursor_idx]);
|
||||
window.set_cursor_icon(CURSORS[cursor_idx]);
|
||||
window.set_cursor(CURSORS[cursor_idx]);
|
||||
if cursor_idx < CURSORS.len() - 1 {
|
||||
cursor_idx += 1;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use winit::{
|
|||
event::{ElementState, Event, KeyEvent, WindowEvent},
|
||||
event_loop::{EventLoop, EventLoopWindowTarget},
|
||||
keyboard::Key,
|
||||
window::{CustomCursor, WindowBuilder},
|
||||
window::{CursorIcon, CustomCursor, WindowBuilder},
|
||||
};
|
||||
|
||||
fn decode_cursor<T>(bytes: &[u8], window_target: &EventLoopWindowTarget<T>) -> CustomCursor {
|
||||
|
|
@ -62,12 +62,12 @@ fn main() -> Result<(), impl std::error::Error> {
|
|||
} => match key.as_ref() {
|
||||
Key::Character("1") => {
|
||||
log::debug!("Setting cursor to {:?}", cursor_idx);
|
||||
window.set_custom_cursor(&custom_cursors[cursor_idx]);
|
||||
window.set_cursor(custom_cursors[cursor_idx].clone());
|
||||
cursor_idx = (cursor_idx + 1) % 2;
|
||||
}
|
||||
Key::Character("2") => {
|
||||
log::debug!("Setting cursor icon to default");
|
||||
window.set_cursor_icon(Default::default());
|
||||
window.set_cursor(CursorIcon::default());
|
||||
}
|
||||
Key::Character("3") => {
|
||||
cursor_visible = !cursor_visible;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ fn main() -> Result<(), impl std::error::Error> {
|
|||
"1" => window.set_window_level(WindowLevel::AlwaysOnTop),
|
||||
"2" => window.set_window_level(WindowLevel::AlwaysOnBottom),
|
||||
"3" => window.set_window_level(WindowLevel::Normal),
|
||||
"c" => window.set_cursor_icon(match state {
|
||||
"c" => window.set_cursor(match state {
|
||||
true => CursorIcon::Progress,
|
||||
false => CursorIcon::Default,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ fn main() -> Result<(), impl std::error::Error> {
|
|||
|
||||
if new_location != cursor_location {
|
||||
cursor_location = new_location;
|
||||
window.set_cursor_icon(cursor_direction_icon(cursor_location))
|
||||
window.set_cursor(cursor_direction_icon(cursor_location))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue