Skip to content

Commit

Permalink
Complete documentation for top-level items (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
alteous authored and tomaka committed Sep 25, 2017
1 parent 9c116a1 commit df7e349
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/events.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::path::PathBuf;
use {WindowId, DeviceId};

/// Describes a generic event.
#[derive(Clone, Debug)]
pub enum Event {
WindowEvent {
Expand All @@ -19,6 +20,7 @@ pub enum Event {
Suspended(bool),
}

/// Describes an event from a `Window`.
#[derive(Clone, Debug)]
pub enum WindowEvent {

Expand Down Expand Up @@ -105,6 +107,7 @@ pub enum DeviceEvent {
Text { codepoint: char },
}

/// Describes a keyboard input event.
#[derive(Debug, Clone, Copy)]
pub struct KeyboardInput {
/// Identifies the physical key pressed
Expand All @@ -129,6 +132,7 @@ pub struct KeyboardInput {
pub modifiers: ModifiersState
}

/// Describes touch-screen input state.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum TouchPhase {
Started,
Expand All @@ -137,7 +141,6 @@ pub enum TouchPhase {
Cancelled
}

#[derive(Debug, Clone, Copy)]
/// Represents touch event
///
/// Every time user touches screen new Start event with some finger id is generated.
Expand All @@ -153,6 +156,7 @@ pub enum TouchPhase {
/// as previously received End event is a new finger and has nothing to do with an old one.
///
/// Touch may be cancelled if for example window lost focus.
#[derive(Debug, Clone, Copy)]
pub struct Touch {
pub device_id: DeviceId,
pub phase: TouchPhase,
Expand All @@ -161,6 +165,7 @@ pub struct Touch {
pub id: u64
}

/// Hardware-dependent keyboard scan code.
pub type ScanCode = u32;

/// Identifier for a specific analog axis on some device.
Expand All @@ -169,12 +174,14 @@ pub type AxisId = u32;
/// Identifier for a specific button on some device.
pub type ButtonId = u32;

/// Describes the input state of a key.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum ElementState {
Pressed,
Released,
}

/// Describes a button of a mouse controller.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum MouseButton {
Left,
Expand All @@ -183,6 +190,7 @@ pub enum MouseButton {
Other(u8),
}

/// Describes a difference in the mouse scroll wheel state.
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum MouseScrollDelta {
/// Amount in lines or rows to scroll in the horizontal
Expand All @@ -200,6 +208,7 @@ pub enum MouseScrollDelta {
PixelDelta(f32, f32)
}

/// Symbolic name for a keyboard key.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
#[repr(u32)]
pub enum VirtualKeyCode {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ impl std::error::Error for CreationError {
}
}

/// Describes the appearance of the mouse cursor.
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum MouseCursor {
/// The platform-dependent default cursor.
Expand Down

0 comments on commit df7e349

Please sign in to comment.