pub mod global;
pub mod state;
pub mod widget;
pub use self::global::Global;
pub use self::state::State;
pub use self::touch::Touch;
pub use self::widget::Widget;
use Scalar;
#[doc(inline)]
pub use piston_input::keyboard::ModifierKey;
#[doc(inline)]
pub use piston_input::{
keyboard, Button, ControllerAxisArgs, ControllerButton, Key, MouseButton, RenderArgs,
};
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Source {
Mouse,
Keyboard,
Touch(self::touch::Id),
}
#[allow(missing_docs)]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Motion {
MouseCursor { x: Scalar, y: Scalar },
MouseRelative { x: Scalar, y: Scalar },
Scroll { x: Scalar, y: Scalar },
ControllerAxis(ControllerAxisArgs),
}
pub mod touch {
use Point;
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Id(u64);
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum Phase {
Start,
Move,
Cancel,
End,
}
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Touch {
pub phase: Phase,
pub id: Id,
pub xy: Point,
}
impl Id {
pub fn new(id: u64) -> Self {
Id(id)
}
}
impl Touch {
pub fn relative_to(&self, xy: Point) -> Self {
Touch {
xy: [self.xy[0] - xy[0], self.xy[1] - xy[1]],
..*self
}
}
}
}