From d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Mon, 21 Dec 2020 01:22:15 +0100 Subject: Add previously missing docs where appropriate --- src/button.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/button.rs') diff --git a/src/button.rs b/src/button.rs index 89ce9a5..846377e 100644 --- a/src/button.rs +++ b/src/button.rs @@ -11,10 +11,13 @@ use std::mem; /// user has free reign over what key they use for what purpose. #[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum Button { + /// Button on the mouse with internal mouse button representation of raylib. Mouse(MouseButton), + /// Keyboard button with internal keyboard key representation of raylib. Keyboard(KeyboardKey), } +#[allow(missing_docs)] #[repr(u32)] #[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum MouseButton { @@ -23,6 +26,7 @@ pub enum MouseButton { Middle = 2, } +#[allow(missing_docs)] #[repr(u32)] #[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum KeyboardKey { @@ -134,6 +138,9 @@ pub enum KeyboardKey { } impl Button { + /// Check if this button is pressed. If `mouse_blocked` is true, mouse buttons are ignored which + /// is useful when an element has captured the mouse, but other elements are still queried in the + /// background. pub fn is_pressed(self, rl: &RaylibHandle, mouse_blocked: bool) -> bool { match self { Self::Mouse(button) => !mouse_blocked && rl.is_mouse_button_pressed(button.into()), -- cgit v1.2.3-70-g09d2