Key

Struct Key 

Source
pub struct Key(/* private fields */);
Expand description

Key codes known to SFML.

Implementations§

Source§

impl Key

Source

pub const UNKNOWN: Key

Unhandled key

Source

pub const A: Key

The A key

Source

pub const B: Key

The B key

Source

pub const C: Key

The C key

Source

pub const D: Key

The D key

Source

pub const E: Key

The E key

Source

pub const F: Key

The F key

Source

pub const G: Key

The G key

Source

pub const H: Key

The H key

Source

pub const I: Key

The I key

Source

pub const J: Key

The J key

Source

pub const K: Key

The K key

Source

pub const L: Key

The L key

Source

pub const M: Key

The M key

Source

pub const N: Key

The N key

Source

pub const O: Key

The O key

Source

pub const P: Key

The P key

Source

pub const Q: Key

The Q key

Source

pub const R: Key

The R key

Source

pub const S: Key

The S key

Source

pub const T: Key

The T key

Source

pub const U: Key

The U key

Source

pub const V: Key

The V key

Source

pub const W: Key

The W key

Source

pub const X: Key

The X key

Source

pub const Y: Key

The Y key

Source

pub const Z: Key

The Z key

Source

pub const NUM0: Key

The 0 key

Source

pub const NUM1: Key

The 1 key

Source

pub const NUM2: Key

The 2 key

Source

pub const NUM3: Key

The 3 key

Source

pub const NUM4: Key

The 4 key

Source

pub const NUM5: Key

The 5 key

Source

pub const NUM6: Key

The 6 key

Source

pub const NUM7: Key

The 7 key

Source

pub const NUM8: Key

The 8 key

Source

pub const NUM9: Key

The 9 key

Source

pub const ESCAPE: Key

The Escape key

Source

pub const LCONTROL: Key

The left Control key

Source

pub const LSHIFT: Key

The left Shift key

Source

pub const LALT: Key

The left Alt key

Source

pub const LSYSTEM: Key

The left OS specific key: window (Windows and Linux), apple (Mac OS X), …

Source

pub const RCONTROL: Key

The right Control key

Source

pub const RSHIFT: Key

The right Shift key

Source

pub const RALT: Key

The right Alt key

Source

pub const RSYSTEM: Key

The right OS specific key: window (Windows and Linux), apple (Mac OS X), …

Source

pub const MENU: Key

The Menu key

Source

pub const LBRACKET: Key

The [ key

Source

pub const RBRACKET: Key

The ] key

Source

pub const SEMICOLON: Key

The ; key

Source

pub const COMMA: Key

The , key

Source

pub const PERIOD: Key

The . key

Source

pub const QUOTE: Key

The ’ key

Source

pub const SLASH: Key

The / key

Source

pub const BACKSLASH: Key

The \ key

Source

pub const TILDE: Key

The ~ key

Source

pub const EQUAL: Key

The = key

Source

pub const HYPHEN: Key

The - key (hyphen)

Source

pub const SPACE: Key

The Space key

Source

pub const ENTER: Key

The Enter/Return keys

Source

pub const BACKSPACE: Key

The Backspace key

Source

pub const TAB: Key

The Tabulation key

Source

pub const PAGEUP: Key

The Page up key

Source

pub const PAGEDOWN: Key

The Page down key

Source

pub const END: Key

The End key

Source

pub const HOME: Key

The Home key

Source

pub const INSERT: Key

The Insert key

Source

pub const DELETE: Key

The Delete key

Source

pub const ADD: Key

The + key

Source

pub const SUBTRACT: Key

The - key (minus, usually from numpad)

Source

pub const MULTIPLY: Key

The * key

Source

pub const DIVIDE: Key

The / key

Source

pub const LEFT: Key

Left arrow

Source

pub const RIGHT: Key

Right arrow

Source

pub const UP: Key

Up arrow

Source

pub const DOWN: Key

Down arrow

Source

pub const NUMPAD0: Key

The numpad 0 key

Source

pub const NUMPAD1: Key

The numpad 1 key

Source

pub const NUMPAD2: Key

The numpad 2 key

Source

pub const NUMPAD3: Key

The numpad 3 key

Source

pub const NUMPAD4: Key

The numpad 4 key

Source

pub const NUMPAD5: Key

The numpad 5 key

Source

pub const NUMPAD6: Key

The numpad 6 key

Source

pub const NUMPAD7: Key

The numpad 7 key

Source

pub const NUMPAD8: Key

The numpad 8 key

Source

pub const NUMPAD9: Key

The numpad 9 key

Source

pub const F1: Key

The F1 key

Source

pub const F2: Key

The F2 key

Source

pub const F3: Key

The F3 key

Source

pub const F4: Key

The F4 key

Source

pub const F5: Key

The F5 key

Source

pub const F6: Key

The F6 key

Source

pub const F7: Key

The F7 key

Source

pub const F8: Key

The F8 key

Source

pub const F9: Key

The F9 key

Source

pub const F10: Key

The F10 key

Source

pub const F11: Key

The F11 key

Source

pub const F12: Key

The F12 key

Source

pub const F13: Key

The F13 key

Source

pub const F14: Key

The F14 key

Source

pub const F15: Key

The F15 key

Source

pub const PAUSE: Key

The Pause key

Source

pub const COUNT: Key

The total number of keyboard keys

Source§

impl Key

Source

pub fn is_pressed(self) -> bool

Return whether this key is currently pressed.

Queries the real-time state of the keyboard, even if keys have been pressed or released while no window was focused and no events were triggered.

Trait Implementations§

Source§

impl Clone for Key

Source§

fn clone(&self) -> Key

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Key

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Hash for Key

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Key

Source§

fn cmp(&self, other: &Key) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Key

Source§

fn eq(&self, other: &Key) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Key

Source§

fn partial_cmp(&self, other: &Key) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Key

Source§

impl Eq for Key

Source§

impl StructuralPartialEq for Key

Auto Trait Implementations§

§

impl Freeze for Key

§

impl RefUnwindSafe for Key

§

impl Send for Key

§

impl Sync for Key

§

impl Unpin for Key

§

impl UnwindSafe for Key

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.