mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
parent
d4dc115bd7
commit
2f87ff6618
5 changed files with 21 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::Input;
|
||||
use crate::{ElementState, Input};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::{Local, Res, ResMut};
|
||||
|
||||
|
@ -10,19 +10,6 @@ pub struct KeyboardInput {
|
|||
pub state: ElementState,
|
||||
}
|
||||
|
||||
/// The current "press" state of an element
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub enum ElementState {
|
||||
Pressed,
|
||||
Released,
|
||||
}
|
||||
|
||||
impl ElementState {
|
||||
pub fn is_pressed(&self) -> bool {
|
||||
matches!(self, ElementState::Pressed)
|
||||
}
|
||||
}
|
||||
|
||||
/// State used by the keyboard input system
|
||||
#[derive(Default)]
|
||||
pub struct KeyboardInputState {
|
||||
|
|
|
@ -60,3 +60,16 @@ impl Plugin for InputPlugin {
|
|||
.add_system_to_stage(bevy_app::stage::EVENT, touch_screen_input_system.system());
|
||||
}
|
||||
}
|
||||
|
||||
/// The current "press" state of an element
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub enum ElementState {
|
||||
Pressed,
|
||||
Released,
|
||||
}
|
||||
|
||||
impl ElementState {
|
||||
pub fn is_pressed(&self) -> bool {
|
||||
matches!(self, ElementState::Pressed)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use super::keyboard::ElementState;
|
||||
use crate::Input;
|
||||
use crate::{ElementState, Input};
|
||||
use bevy_app::prelude::{EventReader, Events};
|
||||
use bevy_ecs::{Local, Res, ResMut};
|
||||
use bevy_math::Vec2;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
use crate::keyboard::{ElementState, KeyCode, KeyboardInput};
|
||||
use crate::{
|
||||
keyboard::{KeyCode, KeyboardInput},
|
||||
ElementState,
|
||||
};
|
||||
use bevy_app::{
|
||||
prelude::{EventReader, Events},
|
||||
AppExit,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use bevy_input::{
|
||||
keyboard::{ElementState, KeyCode, KeyboardInput},
|
||||
keyboard::{KeyCode, KeyboardInput},
|
||||
mouse::MouseButton,
|
||||
touch::{TouchInput, TouchPhase},
|
||||
ElementState,
|
||||
};
|
||||
use bevy_math::Vec2;
|
||||
|
||||
|
|
Loading…
Reference in a new issue