diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 63 |
1 files changed, 13 insertions, 50 deletions
@@ -1,56 +1,19 @@ -mod render; +mod events; mod window; -mod window_controller; -mod window_manager; +mod window_builder; +mod window_program; +mod phosphor; -pub use render::*; -pub use window::*; -pub use window_controller::*; -pub use window_manager::*; +pub use events::{Request, Event, Action, Axis, MouseButton, SizeBounds}; +pub(crate) use window::PhosphorWindow; +pub use window_builder::WindowBuilder; +pub use window_program::WindowProgram; pub use buffer::*; -pub use winit::{ - event::{ModifiersState, ElementState}, - event::VirtualKeyCode as KeyCode, - window::CursorIcon, -}; -pub use std::num::NonZeroU32; +pub use phosphor::Phosphor; +pub use event_queue::EventWriter; -// ----------------------------------------------------------------------------- +pub use winit::keyboard::{KeyCode, ModifiersState}; -#[derive(Copy, Clone)] -pub struct KeyboardInput { - pub action: Action, - pub key: KeyCode, -} - -impl TryFrom<winit::event::KeyboardInput> for KeyboardInput { - type Error = (); - - fn try_from(input: winit::event::KeyboardInput) -> Result<Self, ()> { - if let Some(key) = input.virtual_keycode { - Ok( Self { action: input.state.into(), key } ) - } else { - Err(()) - } - } -} - -// ----------------------------------------------------------------------------- - -#[derive(Clone, Copy, PartialEq, Debug)] -pub enum Action { Pressed, Released } - -impl Action { - pub fn is_pressed(&self) -> bool { *self == Self::Pressed } - pub fn is_released(&self) -> bool { *self == Self::Released } -} - -impl From<ElementState> for Action { - fn from(value: ElementState) -> Self { - match value { - ElementState::Pressed => Action::Pressed, - ElementState::Released => Action::Released, - } - } -} +pub type Position = geometry::Point<i32>; +pub type Dimensions = geometry::Dimensions<u32>; |