Enum bevy::input::keyboard::KeyCode

pub enum KeyCode {
Show 163 variants Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key0, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, Snapshot, Scroll, Pause, Insert, Home, Delete, End, PageDown, PageUp, Left, Up, Right, Down, Back, Return, Space, Compose, Caret, Numlock, Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9, AbntC1, AbntC2, NumpadAdd, Apostrophe, Apps, Asterisk, Plus, At, Ax, Backslash, Calculator, Capital, Colon, Comma, Convert, NumpadDecimal, NumpadDivide, Equals, Grave, Kana, Kanji, LAlt, LBracket, LControl, LShift, LWin, Mail, MediaSelect, MediaStop, Minus, NumpadMultiply, Mute, MyComputer, NavigateForward, NavigateBackward, NextTrack, NoConvert, NumpadComma, NumpadEnter, NumpadEquals, Oem102, Period, PlayPause, Power, PrevTrack, RAlt, RBracket, RControl, RShift, RWin, Semicolon, Slash, Sleep, Stop, NumpadSubtract, Sysrq, Tab, Underline, Unlabeled, VolumeDown, VolumeUp, Wake, WebBack, WebFavorites, WebForward, WebHome, WebRefresh, WebSearch, WebStop, Yen, Copy, Paste, Cut,
}
Expand description

The key code of a KeyboardInput.

Usage

It is used as the generic T value of an Input to create a Res<Input<KeyCode>>. The resource values are mapped to the current layout of the keyboard and correlate to an ScanCode.

Updating

The resource is updated inside of the keyboard_input_system.

Variants§

§

Key1

The 1 key over the letters.

§

Key2

The 2 key over the letters.

§

Key3

The 3 key over the letters.

§

Key4

The 4 key over the letters.

§

Key5

The 5 key over the letters.

§

Key6

The 6 key over the letters.

§

Key7

The 7 key over the letters.

§

Key8

The 8 key over the letters.

§

Key9

The 9 key over the letters.

§

Key0

The 0 key over the letters.

§

A

The A key.

§

B

The B key.

§

C

The C key.

§

D

The D key.

§

E

The E key.

§

F

The F key.

§

G

The G key.

§

H

The H key.

§

I

The I key.

§

J

The J key.

§

K

The K key.

§

L

The L key.

§

M

The M key.

§

N

The N key.

§

O

The O key.

§

P

The P key.

§

Q

The Q key.

§

R

The R key.

§

S

The S key.

§

T

The T key.

§

U

The U key.

§

V

The V key.

§

W

The W key.

§

X

The X key.

§

Y

The Y key.

§

Z

The Z key.

§

Escape

The Escape / ESC key, next to the F1 key.

§

F1

The F1 key.

§

F2

The F2 key.

§

F3

The F3 key.

§

F4

The F4 key.

§

F5

The F5 key.

§

F6

The F6 key.

§

F7

The F7 key.

§

F8

The F8 key.

§

F9

The F9 key.

§

F10

The F10 key.

§

F11

The F11 key.

§

F12

The F12 key.

§

F13

The F13 key.

§

F14

The F14 key.

§

F15

The F15 key.

§

F16

The F16 key.

§

F17

The F17 key.

§

F18

The F18 key.

§

F19

The F19 key.

§

F20

The F20 key.

§

F21

The F21 key.

§

F22

The F22 key.

§

F23

The F23 key.

§

F24

The F24 key.

§

Snapshot

The Snapshot / Print Screen key.

§

Scroll

The Scroll / Scroll Lock key.

§

Pause

The Pause / Break key, next to the Scroll key.

§

Insert

The Insert key, next to the Backspace key.

§

Home

The Home key.

§

Delete

The Delete key.

§

End

The End key.

§

PageDown

The PageDown key.

§

PageUp

The PageUp key.

§

Left

The Left / Left Arrow key.

§

Up

The Up / Up Arrow key.

§

Right

The Right / Right Arrow key.

§

Down

The Down / Down Arrow key.

§

Back

The Back / Backspace key.

§

Return

The Return / Enter key.

§

Space

The Space / Spacebar / key.

§

Compose

The Compose key on Linux.

§

Caret

The Caret / ^ key.

§

Numlock

The Numlock key.

§

Numpad0

The Numpad0 / 0 key.

§

Numpad1

The Numpad1 / 1 key.

§

Numpad2

The Numpad2 / 2 key.

§

Numpad3

The Numpad3 / 3 key.

§

Numpad4

The Numpad4 / 4 key.

§

Numpad5

The Numpad5 / 5 key.

§

Numpad6

The Numpad6 / 6 key.

§

Numpad7

The Numpad7 / 7 key.

§

Numpad8

The Numpad8 / 8 key.

§

Numpad9

The Numpad9 / 9 key.

§

AbntC1

The AbntC1 key.

§

AbntC2

The AbntC2 key.

§

NumpadAdd

The NumpadAdd / + key.

§

Apostrophe

The Apostrophe / ' key.

§

Apps

The Apps key.

§

Asterisk

The Asterisk / * key.

§

Plus

The Plus / + key.

§

At

The At / @ key.

§

Ax

The Ax key.

§

Backslash

The Backslash / \ key.

§

Calculator

The Calculator key.

§

Capital

The Capital key.

§

Colon

The Colon / : key.

§

Comma

The Comma / , key.

§

Convert

The Convert key.

§

NumpadDecimal

The NumpadDecimal / . key.

§

NumpadDivide

The NumpadDivide / / key.

§

Equals

The Equals / = key.

§

Grave

The Grave / Backtick / ` key.

§

Kana

The Kana key.

§

Kanji

The Kanji key.

§

LAlt

The LAlt / Left Alt key. Maps to Left Option on Mac.

§

LBracket

The LBracket / Left Bracket key.

§

LControl

The LControl / Left Control key.

§

LShift

The LShift / Left Shift key.

§

LWin

The LWin / Left Windows key. Maps to Left Command on Mac.

§

Mail

The Mail key.

§

MediaSelect

The MediaSelect key.

§

MediaStop

The MediaStop key.

§

Minus

The Minus / - key.

§

NumpadMultiply

The NumpadMultiply / * key.

§

Mute

The Mute key.

§

MyComputer

The MyComputer key.

§

NavigateForward

The NavigateForward / Prior key.

§

NavigateBackward

The NavigateBackward / Next key.

§

NextTrack

The NextTrack key.

§

NoConvert

The NoConvert key.

§

NumpadComma

The NumpadComma / , key.

§

NumpadEnter

The NumpadEnter key.

§

NumpadEquals

The NumpadEquals / = key.

§

Oem102

The Oem102 key.

§

Period

The Period / . key.

§

PlayPause

The PlayPause key.

§

Power

The Power key.

§

PrevTrack

The PrevTrack key.

§

RAlt

The RAlt / Right Alt key. Maps to Right Option on Mac.

§

RBracket

The RBracket / Right Bracket key.

§

RControl

The RControl / Right Control key.

§

RShift

The RShift / Right Shift key.

§

RWin

The RWin / Right Windows key. Maps to Right Command on Mac.

§

Semicolon

The Semicolon / ; key.

§

Slash

The Slash / / key.

§

Sleep

The Sleep key.

§

Stop

The Stop key.

§

NumpadSubtract

The NumpadSubtract / - key.

§

Sysrq

The Sysrq key.

§

Tab

The Tab / key.

§

Underline

The Underline / _ key.

§

Unlabeled

The Unlabeled key.

§

VolumeDown

The VolumeDown key.

§

VolumeUp

The VolumeUp key.

§

Wake

The Wake key.

§

WebBack

The WebBack key.

§

WebFavorites

The WebFavorites key.

§

WebForward

The WebForward key.

§

WebHome

The WebHome key.

§

WebRefresh

The WebRefresh key.

§

WebSearch

The WebSearch key.

§

WebStop

The WebStop key.

§

Yen

The Yen key.

§

Copy

The Copy key.

§

Paste

The Paste key.

§

Cut

The Cut key.

Trait Implementations§

§

impl Clone for KeyCode

§

fn clone(&self) -> KeyCode

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
§

impl Debug for KeyCode

§

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

Formats the value using the given formatter. Read more
§

impl Enum for KeyCode

§

fn field(&self, __name_param: &str) -> Option<&(dyn Reflect + 'static)>

Returns a reference to the value of the field (in the current variant) with the given name. Read more
§

fn field_at(&self, __index_param: usize) -> Option<&(dyn Reflect + 'static)>

Returns a reference to the value of the field (in the current variant) at the given index.
§

fn field_mut( &mut self, __name_param: &str ) -> Option<&mut (dyn Reflect + 'static)>

Returns a mutable reference to the value of the field (in the current variant) with the given name. Read more
§

fn field_at_mut( &mut self, __index_param: usize ) -> Option<&mut (dyn Reflect + 'static)>

Returns a mutable reference to the value of the field (in the current variant) at the given index.
§

fn index_of(&self, __name_param: &str) -> Option<usize>

Returns the index of the field (in the current variant) with the given name. Read more
§

fn name_at(&self, __index_param: usize) -> Option<&str>

Returns the name of the field (in the current variant) with the given index. Read more
§

fn iter_fields(&self) -> VariantFieldIter<'_>

Returns an iterator over the values of the current variant’s fields.
§

fn field_len(&self) -> usize

Returns the number of fields in the current variant.
§

fn variant_name(&self) -> &str

The name of the current variant.
§

fn variant_index(&self) -> usize

The index of the current variant.
§

fn variant_type(&self) -> VariantType

The type of the current variant.
§

fn clone_dynamic(&self) -> DynamicEnum

§

fn is_variant(&self, variant_type: VariantType) -> bool

Returns true if the current variant’s type matches the given one.
§

fn variant_path(&self) -> String

Returns the full path to the current variant.
§

impl FromReflect for KeyCode

§

fn from_reflect(__param0: &(dyn Reflect + 'static)) -> Option<KeyCode>

Constructs a concrete instance of Self from a reflected value.
§

fn take_from_reflect( reflect: Box<dyn Reflect + 'static, Global> ) -> Result<Self, Box<dyn Reflect + 'static, Global>>

Attempts to downcast the given value to Self using, constructing the value using from_reflect if that fails. Read more
§

impl GetTypeRegistration for KeyCode

§

impl Hash for KeyCode

§

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
§

impl Ord for KeyCode

§

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

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
§

impl PartialEq<KeyCode> for KeyCode

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl PartialOrd<KeyCode> for KeyCode

§

fn partial_cmp(&self, other: &KeyCode) -> 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

This method 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

This method 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

This method 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

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

impl Reflect for KeyCode

§

fn type_name(&self) -> &str

Returns the type name of the underlying type.
§

fn get_type_info(&self) -> &'static TypeInfo

Returns the TypeInfo of the underlying type. Read more
§

fn into_any(self: Box<KeyCode, Global>) -> Box<dyn Any + 'static, Global>

Returns the value as a Box<dyn Any>.
§

fn as_any(&self) -> &(dyn Any + 'static)

Returns the value as a &dyn Any.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Returns the value as a &mut dyn Any.
§

fn into_reflect( self: Box<KeyCode, Global> ) -> Box<dyn Reflect + 'static, Global>

Casts this type to a boxed reflected value.
§

fn as_reflect(&self) -> &(dyn Reflect + 'static)

Casts this type to a reflected value.
§

fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)

Casts this type to a mutable reflected value.
§

fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>

Clones the value as a Reflect trait object. Read more
§

fn set( &mut self, __value_param: Box<dyn Reflect + 'static, Global> ) -> Result<(), Box<dyn Reflect + 'static, Global>>

Performs a type-checked assignment of a reflected value to this value. Read more
§

fn apply(&mut self, __value_param: &(dyn Reflect + 'static))

Applies a reflected value to this value. Read more
§

fn reflect_ref(&self) -> ReflectRef<'_>

Returns an enumeration of “kinds” of type. Read more
§

fn reflect_mut(&mut self) -> ReflectMut<'_>

Returns a mutable enumeration of “kinds” of type. Read more
§

fn reflect_owned(self: Box<KeyCode, Global>) -> ReflectOwned

Returns an owned enumeration of “kinds” of type. Read more
§

fn reflect_hash(&self) -> Option<u64>

Returns a hash of the value (which includes the type). Read more
§

fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>

Returns a “partial equality” comparison result. Read more
§

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

Debug formatter for the value. Read more
§

fn serializable(&self) -> Option<Serializable<'_>>

Returns a serializable version of the value. Read more
§

impl Typed for KeyCode

§

fn type_info() -> &'static TypeInfo

Returns the compile-time info for the underlying type.
§

impl Copy for KeyCode

§

impl Eq for KeyCode

§

impl StructuralEq for KeyCode

§

impl StructuralPartialEq for KeyCode

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,

§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send + 'static>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DynEq for Twhere T: Any + Eq,

§

fn as_any(&self) -> &(dyn Any + 'static)

Casts the type to dyn Any.
§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
§

impl<T> DynHash for Twhere T: DynEq + Hash,

§

fn as_dyn_eq(&self) -> &(dyn DynEq + 'static)

Casts the type to dyn Any.
§

fn dyn_hash(&self, state: &mut dyn Hasher)

Feeds this value into the given Hasher.
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> GetPath for Twhere T: Reflect,

§

fn reflect_path<'r, 'p>( &'r self, path: &'p str ) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>

Returns a reference to the value specified by path. Read more
§

fn reflect_path_mut<'r, 'p>( &'r mut self, path: &'p str ) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>

Returns a mutable reference to the value specified by path. Read more
§

fn path<T, 'r, 'p>( &'r self, path: &'p str ) -> Result<&'r T, ReflectPathError<'p>>where T: Reflect,

Returns a statically typed reference to the value specified by path. Read more
§

fn path_mut<T, 'r, 'p>( &'r mut self, path: &'p str ) -> Result<&'r mut T, ReflectPathError<'p>>where T: Reflect,

Returns a statically typed mutable reference to the value specified by path. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

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
§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<T> TypeData for Twhere T: 'static + Send + Sync + Clone,

§

fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>

§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,

§

impl<T> Event for Twhere T: Send + Sync + 'static,

source§

impl<N> NodeTrait for Nwhere N: Copy + Ord + Hash,