Decouple mouse::Interaction from UserInterface::draw
This commit is contained in:
parent
87afd5b79d
commit
301aac794b
6 changed files with 171 additions and 187 deletions
|
|
@ -268,7 +268,7 @@ pub fn main() -> Result<(), winit::error::EventLoopError> {
|
|||
renderer,
|
||||
);
|
||||
|
||||
let _ = interface.update(
|
||||
let (state, _) = interface.update(
|
||||
&[Event::Window(
|
||||
window::Event::RedrawRequested(
|
||||
Instant::now(),
|
||||
|
|
@ -280,7 +280,21 @@ pub fn main() -> Result<(), winit::error::EventLoopError> {
|
|||
&mut Vec::new(),
|
||||
);
|
||||
|
||||
let mouse_interaction = interface.draw(
|
||||
// Update the mouse cursor
|
||||
if let user_interface::State::Updated {
|
||||
mouse_interaction,
|
||||
..
|
||||
} = state
|
||||
{
|
||||
window.set_cursor(
|
||||
conversion::mouse_interaction(
|
||||
mouse_interaction,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Draw the interface
|
||||
interface.draw(
|
||||
renderer,
|
||||
&Theme::Dark,
|
||||
&renderer::Style::default(),
|
||||
|
|
@ -297,11 +311,6 @@ pub fn main() -> Result<(), winit::error::EventLoopError> {
|
|||
|
||||
// Present the frame
|
||||
frame.present();
|
||||
|
||||
// Update the mouse cursor
|
||||
window.set_cursor(conversion::mouse_interaction(
|
||||
mouse_interaction,
|
||||
));
|
||||
}
|
||||
Err(error) => match error {
|
||||
wgpu::SurfaceError::OutOfMemory => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue