Fix pikachu
This commit is contained in:
parent
950b375609
commit
7e6c67edc9
2 changed files with 7 additions and 5 deletions
|
@ -94,9 +94,9 @@ impl DefaultMesh {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn toggle(&mut self) {
|
pub fn toggle(&mut self, toggle: bool) {
|
||||||
self.toggle = !self.toggle;
|
self.toggle = toggle;
|
||||||
if self.toggle {
|
if !self.toggle {
|
||||||
self.mesh.texture_bind_group = Some(self.texture1_bind_group.clone());
|
self.mesh.texture_bind_group = Some(self.texture1_bind_group.clone());
|
||||||
} else {
|
} else {
|
||||||
self.mesh.texture_bind_group = Some(self.texture2_bind_group.clone());
|
self.mesh.texture_bind_group = Some(self.texture2_bind_group.clone());
|
||||||
|
|
|
@ -5,7 +5,7 @@ use super::render::{
|
||||||
};
|
};
|
||||||
use wgpu::util::DeviceExt;
|
use wgpu::util::DeviceExt;
|
||||||
use winit::{
|
use winit::{
|
||||||
event::{KeyboardInput, VirtualKeyCode, WindowEvent},
|
event::{KeyboardInput, VirtualKeyCode, WindowEvent, ElementState},
|
||||||
window::Window,
|
window::Window,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -297,14 +297,16 @@ impl State {
|
||||||
WindowEvent::KeyboardInput {
|
WindowEvent::KeyboardInput {
|
||||||
input:
|
input:
|
||||||
KeyboardInput {
|
KeyboardInput {
|
||||||
|
state,
|
||||||
virtual_keycode: Some(keycode),
|
virtual_keycode: Some(keycode),
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
|
let is_pressed = *state == ElementState::Pressed;
|
||||||
match keycode {
|
match keycode {
|
||||||
VirtualKeyCode::Space => {
|
VirtualKeyCode::Space => {
|
||||||
self.mesh.toggle();
|
self.mesh.toggle(is_pressed);
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
_ => self.camera_controller.process_events(event),
|
_ => self.camera_controller.process_events(event),
|
||||||
|
|
Loading…
Reference in a new issue