Complete documentation for top-level items (#299)

This commit is contained in:
David Harvey-Macaulay 2017-09-25 14:58:59 +01:00 committed by tomaka
parent 9c116a1bae
commit df7e349c70
2 changed files with 11 additions and 1 deletions

View file

@ -1,6 +1,7 @@
use std::path::PathBuf; use std::path::PathBuf;
use {WindowId, DeviceId}; use {WindowId, DeviceId};
/// Describes a generic event.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Event { pub enum Event {
WindowEvent { WindowEvent {
@ -19,6 +20,7 @@ pub enum Event {
Suspended(bool), Suspended(bool),
} }
/// Describes an event from a `Window`.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum WindowEvent { pub enum WindowEvent {
@ -105,6 +107,7 @@ pub enum DeviceEvent {
Text { codepoint: char }, Text { codepoint: char },
} }
/// Describes a keyboard input event.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub struct KeyboardInput { pub struct KeyboardInput {
/// Identifies the physical key pressed /// Identifies the physical key pressed
@ -129,6 +132,7 @@ pub struct KeyboardInput {
pub modifiers: ModifiersState pub modifiers: ModifiersState
} }
/// Describes touch-screen input state.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)] #[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum TouchPhase { pub enum TouchPhase {
Started, Started,
@ -137,7 +141,6 @@ pub enum TouchPhase {
Cancelled Cancelled
} }
#[derive(Debug, Clone, Copy)]
/// Represents touch event /// Represents touch event
/// ///
/// Every time user touches screen new Start event with some finger id is generated. /// Every time user touches screen new Start event with some finger id is generated.
@ -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. /// 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. /// Touch may be cancelled if for example window lost focus.
#[derive(Debug, Clone, Copy)]
pub struct Touch { pub struct Touch {
pub device_id: DeviceId, pub device_id: DeviceId,
pub phase: TouchPhase, pub phase: TouchPhase,
@ -161,6 +165,7 @@ pub struct Touch {
pub id: u64 pub id: u64
} }
/// Hardware-dependent keyboard scan code.
pub type ScanCode = u32; pub type ScanCode = u32;
/// Identifier for a specific analog axis on some device. /// Identifier for a specific analog axis on some device.
@ -169,12 +174,14 @@ pub type AxisId = u32;
/// Identifier for a specific button on some device. /// Identifier for a specific button on some device.
pub type ButtonId = u32; pub type ButtonId = u32;
/// Describes the input state of a key.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)] #[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum ElementState { pub enum ElementState {
Pressed, Pressed,
Released, Released,
} }
/// Describes a button of a mouse controller.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)] #[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
pub enum MouseButton { pub enum MouseButton {
Left, Left,
@ -183,6 +190,7 @@ pub enum MouseButton {
Other(u8), Other(u8),
} }
/// Describes a difference in the mouse scroll wheel state.
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub enum MouseScrollDelta { pub enum MouseScrollDelta {
/// Amount in lines or rows to scroll in the horizontal /// Amount in lines or rows to scroll in the horizontal
@ -200,6 +208,7 @@ pub enum MouseScrollDelta {
PixelDelta(f32, f32) PixelDelta(f32, f32)
} }
/// Symbolic name for a keyboard key.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)] #[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
#[repr(u32)] #[repr(u32)]
pub enum VirtualKeyCode { pub enum VirtualKeyCode {

View file

@ -310,6 +310,7 @@ impl std::error::Error for CreationError {
} }
} }
/// Describes the appearance of the mouse cursor.
#[derive(Debug, Copy, Clone, PartialEq)] #[derive(Debug, Copy, Clone, PartialEq)]
pub enum MouseCursor { pub enum MouseCursor {
/// The platform-dependent default cursor. /// The platform-dependent default cursor.