vanilladocs
vanillapunch.com
API / core/inputmanager

core/inputmanager

입력 관리자.

  • 키 이름은 원본과 같이 KeyboardEvent.code 꼴이다. ("KeyA", "ArrowLeft", "Space" ...) winit 의 KeyCode 이름이 같은 W3C 규약을 따르므로 그대로 문자열로 바꿔 쓴다. 윈도우 키(커맨드 키)만 winit 이 SuperLeft, SuperRight 라 부르고 W3C 의 옛 Super 키를 Meta 라 불러서, 데스크탑 플랫폼이 MetaLeft, MetaRight, Super 로 바꿔 넣는다.
  • KeyCode 의 상수 이름은 원본 KeyCode 의 키 이름을 러스트 상수 꼴로 바꾼 것이다. ("0" 처럼 이름이 될 수 없는 것은 DIGIT0) 원본에 없던 LEFT, UP, RIGHT, DOWN 은 ARROWLEFT 들과 같은 값으로 남긴다.
  • 마우스 단추(또는 첫 손가락)를 터치로 다룬다. (원본은 마우스와 터치를 하나로 모은다) 원본처럼 처음에는 어느 단추든 터치이고, set_touch_from_left_button_only(true) 면 왼쪽 단추만 터치다. 캔버스의 오른쪽 클릭 메뉴를 막을지(set_context_menu_prevented, 처음은 참)는 웹에서 브라우저 문맥 메뉴를 막는다. 데스크탑 창에는 브라우저 문맥 메뉴가 없어 크롬에서 막은 것과 같은 결과다.
  • 그 밖에 마우스 단추 셋(왼쪽, 가운데, 오른쪽)의 눌림, 닿아 있는 손가락 목록, 마지막 입력이 손가락인지, 휠을 Ctrl 과 함께 굴렸는지를 둔다. 카메라 손짓(CameraGestures)처럼 단추 하나 터치 밖의 입력을 쓰는 곳이 읽는다. 플랫폼이 채운다. (vanilla.js 는 캔버스 DOM 사건을 직접 읽던 것)
  • 게임패드는 원본과 같이 InputManager 가 GamepadManager 를 들고 tick 에서 폴링한다. (core/gamepadmanager.rs)
  • 글 입력(확정 글, IME 조합, 편집 키)은 TextInput 줄에 모은다. 입력 필드가 꺼내 쓴다. (core/textinput.rs, 원본에 없는 층)
  • 키와 마우스 단추의 이번 프레임 누름과 뗌은 원본처럼 지난 프레임 끝 뒤로 온 사건을 쌓아 본다. 프레임 사이에 눌렀다 뗀 것도 잡힌다.
  • 손가락은 원본처럼 닿음(begin_touch_point), 움직임, 뗌을 받아 단계(TouchPhase)를 매기고, 떨어진 손가락은 한 프레임 get_ended_touch_points 에 남는다.
  • 마지막으로 쓴 장치(InputDevice)와 패드 종류, 막을 키(set_prevented_keys), 글자 입력칸에 쓰는 중인지(is_typing_in_text_field), 입력 동작(InputActions)을 둔다. 막을 키는 웹에서 브라우저 기본 동작(Tab 의 포커스 옮기기, Space 와 화살표의 스크롤, F5 새로 고침 같은 것)을 막는다. 데스크탑 창에는 그런 기본 동작이 없어 막은 것과 같은 결과다. 글자 입력칸은 엔진 입력 필드(TextInput 의 활성 필드)와, 웹에서는 문서의 초점(글자 input, textarea, contenteditable, select)을 본다.

Input manager.

  • Key names are in KeyboardEvent.code form like the original. ("KeyA", "ArrowLeft", "Space" ...) winit's KeyCode names follow the same W3C convention, so they are converted to strings as is. Only for the Windows key (Command key), winit calls it SuperLeft, SuperRight and calls the old W3C Super key Meta, so the desktop platform puts in MetaLeft, MetaRight, Super instead.
  • The constant names of KeyCode are the original KeyCode key names converted to Rust constant form. (DIGIT0 for things like "0" that cannot be a name) LEFT, UP, RIGHT, DOWN, which were not in the original, are kept with the same values as the ARROWLEFT family.
  • The mouse button (or first finger) is handled as touch. (the original merges mouse and touch into one) Like the original, initially any button is touch, and with set_touch_from_left_button_only(true) only the left button is touch. Whether to block the canvas right-click menu (set_context_menu_prevented, initially true) blocks the browser context menu on the web. Desktop windows have no browser context menu, so the result is the same as blocking it in Chrome.
  • It also holds the pressed state of the three mouse buttons (left, middle, right), the list of touching fingers, whether the last input was a finger, and whether the wheel was rolled with Ctrl. Places that use input beyond the single button touch, like camera gestures (CameraGestures), read them. The platform fills them in. (vanilla.js read canvas DOM events directly)
  • Gamepads, like the original, are polled in tick by the GamepadManager that InputManager holds. (core/gamepadmanager.rs)
  • Text input (committed text, IME composition, editing keys) is gathered in the TextInput queue. Input fields take it from there. (core/textinput.rs, a layer not in the original)
  • This frame's presses and releases of keys and mouse buttons are seen by accumulating events that came after the end of the last frame, like the original. A press and release between frames is also caught.
  • Fingers, like the original, receive touch (begin_touch_point), move and release and are given a phase (TouchPhase), and a lifted finger stays in get_ended_touch_points for one frame.
  • It holds the last used device (InputDevice) and pad kind, the keys to block (set_prevented_keys), whether typing in a text field (is_typing_in_text_field), and input actions (InputActions). The keys to block prevent browser default actions on the web (such as Tab moving focus, Space and arrows scrolling, F5 refreshing). Desktop windows have no such default actions, so the result is the same as blocking them. For text fields it looks at the engine input field (the active field of TextInput) and, on the web, the document focus (text input, textarea, contenteditable, select).
예제Example플랫폼이 넣은 키, 마우스 단추, 손가락을 읽고 프레임 끝을 넘기기Reading the keys, mouse buttons and fingers the platform put in, and passing the end of the frame
use vanilla::{InputManager, KeyCode, MouseButton, TouchPhase, Vector2};

let mut input_manager = InputManager::new();
input_manager.push_key(KeyCode::SPACE);
input_manager.set_mouse_button_down(MouseButton::Left, true);
input_manager.begin_touch_point(1, Vector2::create(10.0, 20.0), Vector2::create(20.0, 40.0));
assert!(input_manager.is_key_just_pressed(KeyCode::SPACE));
assert!(input_manager.is_mouse_button_just_pressed(MouseButton::Left));
assert_eq!(input_manager.get_touch_points()[0].phase, TouchPhase::Began);

input_manager.update_frame_snapshot();
assert!(input_manager.is_key_pressed(KeyCode::SPACE));
assert!(!input_manager.is_key_just_pressed(KeyCode::SPACE));
assert!(input_manager.is_mouse_button_down(MouseButton::Left));
assert_eq!(input_manager.get_touch_points()[0].phase, TouchPhase::Stationary);

KeyCodestruct

짝Counterpart: vanilla.js KeyCode소스source

키 이름. (원본 KeyCode)

  • 값은 KeyboardEvent.code 문자열이다. 상수에 없는 키는 그 이름 문자열("ShiftRight", "ControlRight" 같은)을 그대로 쓴다.

Key name. (the original KeyCode)

  • The value is a KeyboardEvent.code string. Keys not among the constants use their name string (like "ShiftRight", "ControlRight") as is.
예제Example상수 값과 키 읽기Reading constant values and keys
use vanilla::{InputManager, KeyCode};

assert_eq!(KeyCode::A, "KeyA");
assert_eq!(KeyCode::LEFT, KeyCode::ARROWLEFT);
let mut input_manager = InputManager::new();
input_manager.push_key(KeyCode::ENTER);
assert!(input_manager.is_key_pressed("Enter"));
assert!(!input_manager.is_key_pressed(KeyCode::NUMPAD_ENTER));
정적staticpub const A: &'static str = "KeyA"#0.3.2 부터since 0.3.2소스source

A 키.

A key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.a

정적staticpub const B: &'static str = "KeyB"#0.3.2 부터since 0.3.2소스source

B 키.

B key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.b

정적staticpub const C: &'static str = "KeyC"#0.3.2 부터since 0.3.2소스source

C 키.

C key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.c

정적staticpub const D: &'static str = "KeyD"#0.3.2 부터since 0.3.2소스source

D 키.

D key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.d

정적staticpub const E: &'static str = "KeyE"#0.3.2 부터since 0.3.2소스source

E 키.

E key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.e

정적staticpub const F: &'static str = "KeyF"#0.3.2 부터since 0.3.2소스source

F 키.

F key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f

정적staticpub const G: &'static str = "KeyG"#0.3.2 부터since 0.3.2소스source

G 키.

G key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.g

정적staticpub const H: &'static str = "KeyH"#0.3.2 부터since 0.3.2소스source

H 키.

H key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.h

정적staticpub const I: &'static str = "KeyI"#0.3.2 부터since 0.3.2소스source

I 키.

I key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.i

정적staticpub const J: &'static str = "KeyJ"#0.3.2 부터since 0.3.2소스source

J 키.

J key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.j

정적staticpub const K: &'static str = "KeyK"#0.3.2 부터since 0.3.2소스source

K 키.

K key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.k

정적staticpub const L: &'static str = "KeyL"#0.3.2 부터since 0.3.2소스source

L 키.

L key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.l

정적staticpub const M: &'static str = "KeyM"#0.3.2 부터since 0.3.2소스source

M 키.

M key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.m

정적staticpub const N: &'static str = "KeyN"#0.3.2 부터since 0.3.2소스source

N 키.

N key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.n

정적staticpub const O: &'static str = "KeyO"#0.3.2 부터since 0.3.2소스source

O 키.

O key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.o

정적staticpub const P: &'static str = "KeyP"#0.3.2 부터since 0.3.2소스source

P 키.

P key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.p

정적staticpub const Q: &'static str = "KeyQ"#0.3.2 부터since 0.3.2소스source

Q 키.

Q key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.q

정적staticpub const R: &'static str = "KeyR"#0.3.2 부터since 0.3.2소스source

R 키.

R key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.r

정적staticpub const S: &'static str = "KeyS"#0.3.2 부터since 0.3.2소스source

S 키.

S key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.s

정적staticpub const T: &'static str = "KeyT"#0.3.2 부터since 0.3.2소스source

T 키.

T key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.t

정적staticpub const U: &'static str = "KeyU"#0.3.2 부터since 0.3.2소스source

U 키.

U key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.u

정적staticpub const V: &'static str = "KeyV"#0.3.2 부터since 0.3.2소스source

V 키.

V key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.v

정적staticpub const W: &'static str = "KeyW"#0.3.2 부터since 0.3.2소스source

W 키.

W key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.w

정적staticpub const X: &'static str = "KeyX"#0.3.2 부터since 0.3.2소스source

X 키.

X key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.x

정적staticpub const Y: &'static str = "KeyY"#0.3.2 부터since 0.3.2소스source

Y 키.

Y key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.y

정적staticpub const Z: &'static str = "KeyZ"#0.3.2 부터since 0.3.2소스source

Z 키.

Z key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.z

정적staticpub const DIGIT0: &'static str = "Digit0"#0.3.2 부터since 0.3.2소스source

숫자 0 키. (글자판 위쪽 줄, 텐키는 NUMPAD0)

Digit 0 key. (top row of the main keyboard, the numpad one is NUMPAD0)

반환Returns&'static str

정적staticpub const DIGIT1: &'static str = "Digit1"#0.3.2 부터since 0.3.2소스source

숫자 1 키. (글자판 위쪽 줄, 텐키는 NUMPAD1)

Digit 1 key. (top row of the main keyboard, the numpad one is NUMPAD1)

반환Returns&'static str

정적staticpub const DIGIT2: &'static str = "Digit2"#0.3.2 부터since 0.3.2소스source

숫자 2 키. (글자판 위쪽 줄, 텐키는 NUMPAD2)

Digit 2 key. (top row of the main keyboard, the numpad one is NUMPAD2)

반환Returns&'static str

정적staticpub const DIGIT3: &'static str = "Digit3"#0.3.2 부터since 0.3.2소스source

숫자 3 키. (글자판 위쪽 줄, 텐키는 NUMPAD3)

Digit 3 key. (top row of the main keyboard, the numpad one is NUMPAD3)

반환Returns&'static str

정적staticpub const DIGIT4: &'static str = "Digit4"#0.3.2 부터since 0.3.2소스source

숫자 4 키. (글자판 위쪽 줄, 텐키는 NUMPAD4)

Digit 4 key. (top row of the main keyboard, the numpad one is NUMPAD4)

반환Returns&'static str

정적staticpub const DIGIT5: &'static str = "Digit5"#0.3.2 부터since 0.3.2소스source

숫자 5 키. (글자판 위쪽 줄, 텐키는 NUMPAD5)

Digit 5 key. (top row of the main keyboard, the numpad one is NUMPAD5)

반환Returns&'static str

정적staticpub const DIGIT6: &'static str = "Digit6"#0.3.2 부터since 0.3.2소스source

숫자 6 키. (글자판 위쪽 줄, 텐키는 NUMPAD6)

Digit 6 key. (top row of the main keyboard, the numpad one is NUMPAD6)

반환Returns&'static str

정적staticpub const DIGIT7: &'static str = "Digit7"#0.3.2 부터since 0.3.2소스source

숫자 7 키. (글자판 위쪽 줄, 텐키는 NUMPAD7)

Digit 7 key. (top row of the main keyboard, the numpad one is NUMPAD7)

반환Returns&'static str

정적staticpub const DIGIT8: &'static str = "Digit8"#0.3.2 부터since 0.3.2소스source

숫자 8 키. (글자판 위쪽 줄, 텐키는 NUMPAD8)

Digit 8 key. (top row of the main keyboard, the numpad one is NUMPAD8)

반환Returns&'static str

정적staticpub const DIGIT9: &'static str = "Digit9"#0.3.2 부터since 0.3.2소스source

숫자 9 키. (글자판 위쪽 줄, 텐키는 NUMPAD9)

Digit 9 key. (top row of the main keyboard, the numpad one is NUMPAD9)

반환Returns&'static str

정적staticpub const BACKSPACE: &'static str = "Backspace"#0.3.2 부터since 0.3.2소스source

백스페이스 키.

Backspace key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.backspace

정적staticpub const TAB: &'static str = "Tab"#0.3.2 부터since 0.3.2소스source

탭 키.

Tab key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.tab

정적staticpub const ENTER: &'static str = "Enter"#0.3.2 부터since 0.3.2소스source

엔터 키. (글자판 쪽, 텐키 엔터는 NUMPAD_ENTER)

Enter key. (main keyboard, the numpad Enter is NUMPAD_ENTER)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.enter

정적staticpub const SHIFT: &'static str = "ShiftLeft"#0.3.2 부터since 0.3.2소스source

왼쪽 시프트 키. (오른쪽은 "ShiftRight")

Left Shift key. (the right one is "ShiftRight")

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.shift

정적staticpub const CTRL: &'static str = "ControlLeft"#0.3.2 부터since 0.3.2소스source

왼쪽 컨트롤 키. (오른쪽은 "ControlRight")

Left Control key. (the right one is "ControlRight")

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.ctrl

정적staticpub const ALT: &'static str = "AltLeft"#0.3.2 부터since 0.3.2소스source

왼쪽 알트 키. (오른쪽은 "AltRight")

Left Alt key. (the right one is "AltRight")

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.alt

정적staticpub const CAPSLOCK: &'static str = "CapsLock"#0.3.2 부터since 0.3.2소스source

캡스 록 키.

Caps Lock key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.capslock

정적staticpub const ESCAPE: &'static str = "Escape"#0.3.2 부터since 0.3.2소스source

이스케이프 키.

Escape key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.escape

정적staticpub const SPACE: &'static str = "Space"#0.3.2 부터since 0.3.2소스source

스페이스 바.

Space bar.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.space

정적staticpub const PAGEUP: &'static str = "PageUp"#0.3.2 부터since 0.3.2소스source

페이지 업 키.

Page Up key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.pageup

정적staticpub const PAGEDOWN: &'static str = "PageDown"#0.3.2 부터since 0.3.2소스source

페이지 다운 키.

Page Down key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.pagedown

정적staticpub const END: &'static str = "End"#0.3.2 부터since 0.3.2소스source

엔드 키.

End key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.end

정적staticpub const HOME: &'static str = "Home"#0.3.2 부터since 0.3.2소스source

홈 키.

Home key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.home

정적staticpub const LEFT: &'static str = "ArrowLeft"#0.3.2 부터since 0.3.2소스source

왼쪽 화살표 키. (ARROWLEFT 와 같은 값)

Left arrow key. (same value as ARROWLEFT)

반환Returns&'static str

정적staticpub const UP: &'static str = "ArrowUp"#0.3.2 부터since 0.3.2소스source

위쪽 화살표 키. (ARROWUP 과 같은 값)

Up arrow key. (same value as ARROWUP)

반환Returns&'static str

정적staticpub const RIGHT: &'static str = "ArrowRight"#0.3.2 부터since 0.3.2소스source

오른쪽 화살표 키. (ARROWRIGHT 와 같은 값)

Right arrow key. (same value as ARROWRIGHT)

반환Returns&'static str

정적staticpub const DOWN: &'static str = "ArrowDown"#0.3.2 부터since 0.3.2소스source

아래쪽 화살표 키. (ARROWDOWN 과 같은 값)

Down arrow key. (same value as ARROWDOWN)

반환Returns&'static str

정적staticpub const INSERT: &'static str = "Insert"#0.3.2 부터since 0.3.2소스source

인서트 키.

Insert key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.insert

정적staticpub const DELETE: &'static str = "Delete"#0.3.2 부터since 0.3.2소스source

딜리트 키.

Delete key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.delete

정적staticpub const F1: &'static str = "F1"#0.3.2 부터since 0.3.2소스source

F1 키.

F1 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f1

정적staticpub const F2: &'static str = "F2"#0.3.2 부터since 0.3.2소스source

F2 키.

F2 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f2

정적staticpub const F3: &'static str = "F3"#0.3.2 부터since 0.3.2소스source

F3 키.

F3 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f3

정적staticpub const F4: &'static str = "F4"#0.3.2 부터since 0.3.2소스source

F4 키.

F4 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f4

정적staticpub const F5: &'static str = "F5"#0.3.2 부터since 0.3.2소스source

F5 키.

F5 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f5

정적staticpub const F6: &'static str = "F6"#0.3.2 부터since 0.3.2소스source

F6 키.

F6 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f6

정적staticpub const F7: &'static str = "F7"#0.3.2 부터since 0.3.2소스source

F7 키.

F7 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f7

정적staticpub const F8: &'static str = "F8"#0.3.2 부터since 0.3.2소스source

F8 키.

F8 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f8

정적staticpub const F9: &'static str = "F9"#0.3.2 부터since 0.3.2소스source

F9 키.

F9 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f9

정적staticpub const F10: &'static str = "F10"#0.3.2 부터since 0.3.2소스source

F10 키.

F10 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f10

정적staticpub const F11: &'static str = "F11"#0.3.2 부터since 0.3.2소스source

F11 키.

F11 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f11

정적staticpub const F12: &'static str = "F12"#0.3.2 부터since 0.3.2소스source

F12 키.

F12 key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.f12

정적staticpub const ARROWLEFT: &'static str = "ArrowLeft"#0.4.0 부터since 0.4.0소스source

왼쪽 화살표 키.

Left arrow key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.arrowleft

정적staticpub const ARROWUP: &'static str = "ArrowUp"#0.4.0 부터since 0.4.0소스source

위쪽 화살표 키.

Up arrow key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.arrowup

정적staticpub const ARROWRIGHT: &'static str = "ArrowRight"#0.4.0 부터since 0.4.0소스source

오른쪽 화살표 키.

Right arrow key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.arrowright

정적staticpub const ARROWDOWN: &'static str = "ArrowDown"#0.4.0 부터since 0.4.0소스source

아래쪽 화살표 키.

Down arrow key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.arrowdown

정적staticpub const SCROLLLOCK: &'static str = "ScrollLock"#0.4.0 부터since 0.4.0소스source

스크롤 록 키.

Scroll Lock key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.scrolllock

정적staticpub const SEMICOLON: &'static str = "Semicolon"#0.4.0 부터since 0.4.0소스source

세미콜론 키. (;)

Semicolon key. (;)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.semicolon

정적staticpub const EQUAL: &'static str = "Equal"#0.4.0 부터since 0.4.0소스source

등호 키. (=)

Equal key. (=)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.equal

정적staticpub const COMMA: &'static str = "Comma"#0.4.0 부터since 0.4.0소스source

쉼표 키. (,)

Comma key. (,)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.comma

정적staticpub const MINUS: &'static str = "Minus"#0.4.0 부터since 0.4.0소스source

빼기 키. (-)

Minus key. (-)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.minus

정적staticpub const PERIOD: &'static str = "Period"#0.4.0 부터since 0.4.0소스source

마침표 키. (.)

Period key. (.)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.period

정적staticpub const SLASH: &'static str = "Slash"#0.4.0 부터since 0.4.0소스source

빗금 키. (/)

Slash key. (/)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.slash

정적staticpub const BACKQUOTE: &'static str = "Backquote"#0.4.0 부터since 0.4.0소스source

백쿼트 키. (숫자 1 왼쪽 키)

Backquote key. (the key left of digit 1)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.backquote

정적staticpub const BRACKETLEFT: &'static str = "BracketLeft"#0.4.0 부터since 0.4.0소스source

왼쪽 대괄호 키. ([)

Left bracket key. ([)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.bracketleft

정적staticpub const BACKSLASH: &'static str = "Backslash"#0.4.0 부터since 0.4.0소스source

역빗금 키. (\)

Backslash key. (\)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.backslash

정적staticpub const BRACKETRIGHT: &'static str = "BracketRight"#0.4.0 부터since 0.4.0소스source

오른쪽 대괄호 키. (])

Right bracket key. (])

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.bracketright

정적staticpub const QUOTE: &'static str = "Quote"#0.4.0 부터since 0.4.0소스source

따옴표 키. (')

Quote key. (')

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.quote

정적staticpub const META: &'static str = "MetaLeft"#0.4.0 부터since 0.4.0소스source

왼쪽 메타 키. (윈도우 키, 맥의 커맨드 키)

Left Meta key. (the Windows key, the Command key on Mac)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.meta

정적staticpub const COMMAND: &'static str = "MetaLeft"#0.4.0 부터since 0.4.0소스source

맥의 왼쪽 커맨드 키. (META 와 같은 값)

Left Command key on Mac. (same value as META)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.command

정적staticpub const PAUSE: &'static str = "Pause"#0.4.0 부터since 0.4.0소스source

일시 정지 키.

Pause key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.pause

정적staticpub const AUDIOVOLUMEUP: &'static str = "AudioVolumeUp"#0.4.0 부터since 0.4.0소스source

소리 키우기 키.

Volume up key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.audiovolumeup

정적staticpub const AUDIOVOLUMEDOWN: &'static str = "AudioVolumeDown"#0.4.0 부터since 0.4.0소스source

소리 줄이기 키.

Volume down key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.audiovolumedown

정적staticpub const AUDIOMUTE: &'static str = "AudioVolumeMute"#0.4.0 부터since 0.4.0소스source

음소거. (W3C code 표의 이름 AudioVolumeMute)

Mute. (AudioVolumeMute, its name in the W3C code table)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.audiomute

정적staticpub const AUDIOPLAY: &'static str = "MediaPlayPause"#0.4.0 부터since 0.4.0소스source

재생/멈춤. (W3C code 표의 이름 MediaPlayPause, 표에 MediaPlay 는 없다)

Play/pause. (MediaPlayPause, its name in the W3C code table, the table has no MediaPlay)

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.audioplay

정적staticpub const AUDIOSTOP: &'static str = "MediaStop"#0.4.0 부터since 0.4.0소스source

미디어 정지 키.

Media stop key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.audiostop

정적staticpub const AUDIOPREV: &'static str = "MediaTrackPrevious"#0.4.0 부터since 0.4.0소스source

이전 곡 키.

Previous track key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.audioprev

정적staticpub const AUDIONEXT: &'static str = "MediaTrackNext"#0.4.0 부터since 0.4.0소스source

다음 곡 키.

Next track key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.audionext

정적staticpub const NUM_LOCK: &'static str = "NumLock"#0.4.0 부터since 0.4.0소스source

넘 록 키.

Num Lock key.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numLock

정적staticpub const NUMPAD_DIVIDE: &'static str = "NumpadDivide"#0.4.0 부터since 0.4.0소스source

텐키 나누기.

Numpad divide.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpadDivide

정적staticpub const NUMPAD_MULTIPLY: &'static str = "NumpadMultiply"#0.4.0 부터since 0.4.0소스source

텐키 곱하기.

Numpad multiply.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpadMultiply

정적staticpub const NUMPAD_SUBTRACT: &'static str = "NumpadSubtract"#0.4.0 부터since 0.4.0소스source

텐키 빼기.

Numpad subtract.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpadSubtract

정적staticpub const NUMPAD_DECIMAL: &'static str = "NumpadDecimal"#0.4.0 부터since 0.4.0소스source

텐키 점.

Numpad decimal point.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpadDecimal

정적staticpub const NUMPAD_ADD: &'static str = "NumpadAdd"#0.4.0 부터since 0.4.0소스source

텐키 더하기.

Numpad add.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpadAdd

정적staticpub const NUMPAD_ENTER: &'static str = "NumpadEnter"#0.4.0 부터since 0.4.0소스source

텐키 엔터.

Numpad Enter.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpadEnter

정적staticpub const NUMPAD0: &'static str = "Numpad0"#0.4.0 부터since 0.4.0소스source

텐키 0.

Numpad 0.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad0

정적staticpub const NUMPAD1: &'static str = "Numpad1"#0.4.0 부터since 0.4.0소스source

텐키 1.

Numpad 1.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad1

정적staticpub const NUMPAD2: &'static str = "Numpad2"#0.4.0 부터since 0.4.0소스source

텐키 2.

Numpad 2.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad2

정적staticpub const NUMPAD3: &'static str = "Numpad3"#0.4.0 부터since 0.4.0소스source

텐키 3.

Numpad 3.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad3

정적staticpub const NUMPAD4: &'static str = "Numpad4"#0.4.0 부터since 0.4.0소스source

텐키 4.

Numpad 4.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad4

정적staticpub const NUMPAD5: &'static str = "Numpad5"#0.4.0 부터since 0.4.0소스source

텐키 5.

Numpad 5.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad5

정적staticpub const NUMPAD6: &'static str = "Numpad6"#0.4.0 부터since 0.4.0소스source

텐키 6.

Numpad 6.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad6

정적staticpub const NUMPAD7: &'static str = "Numpad7"#0.4.0 부터since 0.4.0소스source

텐키 7.

Numpad 7.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad7

정적staticpub const NUMPAD8: &'static str = "Numpad8"#0.4.0 부터since 0.4.0소스source

텐키 8.

Numpad 8.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad8

정적staticpub const NUMPAD9: &'static str = "Numpad9"#0.4.0 부터since 0.4.0소스source

텐키 9.

Numpad 9.

반환Returns&'static str

짝Counterpart: vanilla.js KeyCode.numpad9

TouchPointstruct traits Clone, Copy, PartialEq, Debug

짝Counterpart: vanilla.js TouchPoint소스source

닿아 있는 손가락 하나. (플랫폼의 손가락 번호, 단계, 캔버스 논리 좌표와 뷰 좌표)

One touching finger. (the platform's finger number, phase, canvas logical coordinates and view coordinates)

예제Example손가락 둘을 닿게 하고 하나를 떼기Touching with two fingers and lifting one
use vanilla::{InputManager, TouchPhase, Vector2};

let mut input_manager = InputManager::new();
input_manager.begin_touch_point(3, Vector2::create(10.0, 10.0), Vector2::create(20.0, 20.0));
input_manager.begin_touch_point(4, Vector2::create(50.0, 10.0), Vector2::create(100.0, 20.0));
input_manager.end_touch_point(3, Vector2::create(12.0, 10.0), Vector2::create(24.0, 20.0), false);
let touch_point = input_manager.get_touch_points()[0];
assert_eq!(touch_point.identifier, 4);
assert_eq!(touch_point.view_position, Vector2::create(100.0, 20.0));
let ended_touch_point = input_manager.get_ended_touch_points()[0];
assert_eq!(ended_touch_point.phase, TouchPhase::Ended);
assert_eq!(ended_touch_point.canvas_native_position, Vector2::create(12.0, 10.0));
필드fieldpub identifier: i64#0.4.0 부터since 0.4.0소스source

플랫폼의 손가락 번호. (닿아 있는 동안 같다)

The platform's finger number. (stays the same while touching)

반환Returnsi64

짝Counterpart: vanilla.js TouchPoint.identifier

필드fieldpub phase: TouchPhase#0.4.0 부터since 0.4.0소스source

단계.

Phase.

반환ReturnsTouchPhase

짝Counterpart: vanilla.js TouchPoint.phase

필드fieldpub canvas_native_position: Vector2#0.4.0 부터since 0.4.0소스source

창(캔버스) 안쪽 논리 좌표의 자리. (캔버스 왼쪽 위가 0, 논리 픽셀)

Position in logical coordinates inside the window (canvas). (0 at the top left of the canvas, logical pixels)

반환ReturnsVector2

짝Counterpart: vanilla.js TouchPoint.canvasNativePosition

필드fieldpub view_position: Vector2#0.4.0 부터since 0.4.0소스source

뷰 좌표의 자리. (ViewManager.canvas_position_to_view_position 으로 바꾼 것)

Position in view coordinates. (converted with ViewManager.canvas_position_to_view_position)

반환ReturnsVector2

짝Counterpart: vanilla.js TouchPoint.viewPosition

InputManagerstruct traits Default

짝Counterpart: vanilla.js InputManager소스source

입력 관리자. (원본 InputManager)

  • 엔진이 하나 들고 플랫폼이 키, 마우스, 손가락, 휠 사건을 넣는다. 씬은 engine.get_input_manager() 로 읽는다.
  • 이번 프레임의 누름과 뗌, 터치 Pressed / Released / Cancelled, 휠 이동량은 엔진이 프레임 끝에 비운다.

Input manager. (the original InputManager)

  • The engine holds one and the platform puts in key, mouse, finger and wheel events. Scenes read it with engine.get_input_manager().
  • This frame's presses and releases, touch Pressed / Released / Cancelled, and wheel deltas are cleared by the engine at the end of the frame.
예제Example씬에서 키, 마우스, 휠 읽기Reading keys, mouse and wheel in a scene
use vanilla::{Engine, EngineConfiguration, KeyCode, MouseButton, Scene, SceneBase};

struct MainScene {
	scene_base: SceneBase,
}

impl Scene for MainScene {
	fn get_scene_base(&self) -> &SceneBase {
		&self.scene_base
	}

	fn get_scene_base_mut(&mut self) -> &mut SceneBase {
		&mut self.scene_base
	}

	fn load(&mut self, engine: &Engine) {
		let mut input_manager = engine.get_input_manager_mut();
		input_manager.set_prevented_keys(&[KeyCode::TAB, KeyCode::SPACE]);
		input_manager.set_touch_from_left_button_only(true);
	}

	fn tick(&mut self, time_delta: f64) {
		let engine = Engine::get_engine().unwrap();
		self.scene_base.tick(time_delta);
		let input_manager = engine.get_input_manager();
		if input_manager.is_key_just_pressed(KeyCode::SPACE) {
			println!("jump");
		}
		if input_manager.is_mouse_button_down(MouseButton::Right) {
			println!("{:?}", input_manager.get_view_input_position());
		}
		if input_manager.has_wheel_delta() {
			println!("{}", input_manager.get_wheel_delta_y());
		}
	}
}

let engine_configuration = EngineConfiguration::new();
let engine = Engine::new(engine_configuration);
let main_scene = MainScene {
	scene_base: SceneBase::new(),
};
engine.run(Box::new(main_scene)).unwrap();
생성자constructorpub fn new() -> InputManager#0.3.2 부터since 0.3.2소스source

생성.

  • 오른쪽 클릭 메뉴는 막고, 어느 마우스 단추든 터치로 넘긴다. 손가락이 주된 입력인 기기면 마지막 장치가 Touch 로 시작한다.

Constructor.

  • Blocks the right-click menu and passes any mouse button as touch. On devices whose main input is fingers, the last device starts as Touch.

반환ReturnsInputManager 아무 키도 눌리지 않은 입력 관리자.Input manager with no keys pressed.

짝Counterpart: vanilla.js InputManager.constructor

메서드methodpub fn tick(&mut self, time_delta: f64)#0.3.2 부터since 0.3.2소스source

주기적 갱신. (게임패드 폴링, 패드를 썼으면 마지막 장치를 게임패드로, 입력 동작 갱신)

  • 엔진이 프레임 첫머리에 부른다. 처음 부를 때 게임패드 입력원(데스크탑 gilrs)을 연다.

Periodic update. (polls gamepads, sets the last device to gamepad if a pad was used, updates input actions)

  • The engine calls it at the start of a frame. On the first call it opens the gamepad input source (gilrs on desktop).
time_deltaf64
지난 프레임 뒤로 흐른 초. (입력 동작의 반복 시간에 쓴다)Seconds elapsed since the last frame. (used for the repeat timing of input actions)

짝Counterpart: vanilla.js InputManager.tick

메서드methodpub fn clear(&mut self)#0.3.2 부터since 0.3.2소스source

모든 입력 상태 비우기. (창이 포커스를 잃었을 때)

Clears all input state. (when the window loses focus)

짝Counterpart: vanilla.js InputManager.clear

메서드methodpub fn add_wheel_delta(&mut self, delta_x: f64, delta_y: f64)#0.3.2 부터since 0.3.2소스source

휠 이동량 누적.

  • 플랫폼이 휠 사건마다 부르고, 엔진이 프레임 끝에 clear_wheel_delta 로 비운다.

Accumulates wheel deltas.

  • The platform calls it for every wheel event, and the engine clears it with clear_wheel_delta at the end of the frame.
delta_xf64
가로 이동량. (픽셀, 브라우저 WheelEvent.deltaX 와 같은 방향)Horizontal delta. (pixels, same direction as the browser WheelEvent.deltaX)
delta_yf64
세로 이동량. (픽셀, 브라우저 WheelEvent.deltaY 와 같은 방향, 내용을 아래로 넘기면 양수)Vertical delta. (pixels, same direction as the browser WheelEvent.deltaY, positive when scrolling the content down)

짝Counterpart: vanilla.js InputManager.addWheelDelta

예제Example한 프레임에 두 번 굴린 휠을 모아 읽기Reading two wheel rolls in one frame together
use vanilla::InputManager;

let mut input_manager = InputManager::new();
input_manager.add_wheel_delta(0.0, 40.0);
input_manager.add_wheel_delta(0.0, 40.0);
assert!(input_manager.has_wheel_delta());
assert_eq!(input_manager.get_wheel_delta_y(), 80.0);
input_manager.clear_wheel_delta();
assert!(!input_manager.has_wheel_delta());
메서드methodpub fn get_wheel_delta_x(&self) -> f64#0.3.2 부터since 0.3.2소스source

이번 프레임의 가로 휠 이동량.

Horizontal wheel delta this frame.

반환Returnsf64 이번 프레임에 쌓인 가로 이동량. (픽셀, 오른쪽으로 넘기면 양수)Horizontal delta accumulated this frame. (pixels, positive when scrolling right)

짝Counterpart: vanilla.js InputManager.getWheelDeltaX

메서드methodpub fn get_wheel_delta_y(&self) -> f64#0.3.2 부터since 0.3.2소스source

이번 프레임의 세로 휠 이동량.

Vertical wheel delta this frame.

반환Returnsf64 이번 프레임에 쌓인 세로 이동량. (픽셀, 내용을 아래로 넘기면 양수)Vertical delta accumulated this frame. (pixels, positive when scrolling the content down)

짝Counterpart: vanilla.js InputManager.getWheelDeltaY

메서드methodpub fn has_wheel_delta(&self) -> bool#0.3.2 부터since 0.3.2소스source

이번 프레임에 휠을 굴렸는지.

Whether the wheel was rolled this frame.

반환Returnsbool 가로나 세로 이동량이 0 이 아니면 true.true if the horizontal or vertical delta is not 0.

짝Counterpart: vanilla.js InputManager.hasWheelDelta

메서드methodpub fn clear_wheel_delta(&mut self)#0.3.2 부터since 0.3.2소스source

휠 이동량 비우기. (엔진이 프레임 끝에 부른다)

Clears the wheel deltas. (called by the engine at the end of the frame)

짝Counterpart: vanilla.js InputManager.clearWheelDelta

메서드methodpub fn push_key(&mut self, key: &str)#0.3.2 부터since 0.3.2소스source

키 눌림 기록.

  • 이미 눌려 있으면(키 되풀이) 이번 프레임의 누름으로 세지 않는다.

Records a key press.

  • If already pressed (key repeat), it is not counted as a press this frame.
key&str
키 이름. (KeyboardEvent.code, KeyCode 의 값)Key name. (KeyboardEvent.code, a KeyCode value)

짝Counterpart: vanilla.js InputManager.pushKey

메서드methodpub fn pop_key(&mut self, key: &str)#0.3.2 부터since 0.3.2소스source

키 뗌 기록.

  • 눌려 있지 않던 키면 아무것도 하지 않는다.

Records a key release.

  • Does nothing if the key was not pressed.
key&str
키 이름. (KeyboardEvent.code, KeyCode 의 값)Key name. (KeyboardEvent.code, a KeyCode value)

짝Counterpart: vanilla.js InputManager.popKey

메서드methodpub fn is_key_pressed(&self, key: &str) -> bool#0.3.2 부터since 0.3.2소스source

키가 눌려 있는지.

Whether a key is pressed.

key&str
키 이름. (KeyboardEvent.code, KeyCode 의 값)Key name. (KeyboardEvent.code, a KeyCode value)

반환Returnsbool 눌린 채면 true.true if held.

짝Counterpart: vanilla.js InputManager.isKeyPressed

메서드methodpub fn is_key_just_pressed(&self, key: &str) -> bool#0.3.2 부터since 0.3.2소스source

이번 프레임에 눌렸는지. (지난 프레임 끝 뒤로 온 사건, 프레임 사이에 눌렀다 뗀 키도 참이고 그때는 is_key_pressed 가 거짓)

Whether pressed this frame. (events since the end of the last frame, also true for a key pressed and released between frames, in which case is_key_pressed is false)

key&str
키 이름. (KeyboardEvent.code, KeyCode 의 값)Key name. (KeyboardEvent.code, a KeyCode value)

반환Returnsbool 지난 프레임 끝 뒤로 새로 눌렸으면 true. (키 되풀이는 세지 않는다)true if newly pressed since the end of the last frame. (key repeat is not counted)

짝Counterpart: vanilla.js InputManager.isKeyJustPressed

예제Example프레임 사이에 눌렀다 뗀 키A key pressed and released between frames
use vanilla::{InputManager, KeyCode};

let mut input_manager = InputManager::new();
input_manager.push_key(KeyCode::Z);
input_manager.pop_key(KeyCode::Z);
assert!(input_manager.is_key_just_pressed(KeyCode::Z));
assert!(input_manager.is_key_just_released(KeyCode::Z));
assert!(!input_manager.is_key_pressed(KeyCode::Z));
input_manager.update_frame_snapshot();
assert!(!input_manager.is_key_just_pressed(KeyCode::Z));
메서드methodpub fn is_key_just_released(&self, key: &str) -> bool#0.3.2 부터since 0.3.2소스source

이번 프레임에 떼졌는지.

Whether released this frame.

key&str
키 이름. (KeyboardEvent.code, KeyCode 의 값)Key name. (KeyboardEvent.code, a KeyCode value)

반환Returnsbool 지난 프레임 끝 뒤로 떼어졌으면 true.true if released since the end of the last frame.

짝Counterpart: vanilla.js InputManager.isKeyJustReleased

메서드methodpub fn update_frame_snapshot(&mut self)#0.3.2 부터since 0.3.2소스source

프레임 끝 스냅샷. (쌓인 키와 마우스 단추의 누름과 뗌을 비우고, 떨어진 손가락을 지우고 남은 손가락을 가만히로)

End-of-frame snapshot. (clears accumulated presses and releases of keys and mouse buttons, removes lifted fingers and sets the remaining fingers to stationary)

짝Counterpart: vanilla.js InputManager.updateFrameSnapshot

메서드methodpub fn set_mouse_button_down(&mut self, mouse_button: MouseButton, is_down: bool)#0.4.0 부터since 0.4.0소스source

마우스 단추 눌림 설정. (플랫폼이 부른다)

  • 바뀐 때만 이번 프레임의 누름이나 뗌으로 쌓는다.

Sets a mouse button's pressed state. (called by the platform)

  • Accumulated as a press or release this frame only when it changes.
mouse_buttonMouseButton
단추.Button.
is_downbool
눌렸으면 true, 뗐으면 false.true if pressed, false if released.

짝Counterpart: vanilla.js InputManager.setMouseButtonDown

메서드methodpub fn is_mouse_button_down(&self, mouse_button: MouseButton) -> bool#0.4.0 부터since 0.4.0소스source

마우스 단추가 눌려 있는지.

Whether the mouse button is pressed.

mouse_buttonMouseButton
단추.Button.

반환Returnsbool 눌린 채면 true.true if held.

짝Counterpart: vanilla.js InputManager.isMouseButtonDown

메서드methodpub fn is_mouse_button_just_pressed(&self, mouse_button: MouseButton) -> bool#0.4.0 부터since 0.4.0소스source

이번 프레임에 마우스 단추를 눌렀는지.

Whether a mouse button was pressed this frame.

mouse_buttonMouseButton
단추.Button.

반환Returnsbool 지난 프레임 끝 뒤로 눌렀으면 true. (프레임 사이에 눌렀다 뗀 것도)true if pressed since the end of the last frame. (including a press and release between frames)

짝Counterpart: vanilla.js InputManager.isMouseButtonJustPressed

메서드methodpub fn is_mouse_button_just_released(&self, mouse_button: MouseButton) -> bool#0.4.0 부터since 0.4.0소스source

이번 프레임에 마우스 단추를 뗐는지.

Whether the mouse button was released this frame.

mouse_buttonMouseButton
단추.Button.

반환Returnsbool 지난 프레임 끝 뒤로 뗐으면 true.true if released since the end of the last frame.

짝Counterpart: vanilla.js InputManager.isMouseButtonJustReleased

메서드methodpub fn set_touch_from_left_button_only(&mut self, is_left_button_only: bool)#0.4.0 부터since 0.4.0소스source

마우스 왼쪽 단추만 터치로 넘길지 설정. (끄면(기본) 어느 단추든 터치다)

  • 오른쪽이나 가운데 끌기를 카메라에 쓰는 게임이 켜면 그 단추로 UI 가 눌리지 않는다.

Sets whether to pass only the left mouse button as touch. (when off (default), any button is touch)

  • When a game that uses right or middle dragging for the camera turns it on, the UI is not pressed by those buttons.
is_left_button_onlybool
왼쪽 단추만 터치로 넘기려면 true.true to pass only the left button as touch.

짝Counterpart: vanilla.js InputManager.setTouchFromLeftButtonOnly

예제Example오른쪽 단추를 터치에서 빼기Excluding the right button from touch
use vanilla::{InputManager, MouseButton};

let mut input_manager = InputManager::new();
assert!(input_manager.is_touch_button(MouseButton::Right));
input_manager.set_touch_from_left_button_only(true);
assert!(input_manager.is_touch_button(MouseButton::Left));
assert!(!input_manager.is_touch_button(MouseButton::Right));
메서드methodpub fn is_touch_from_left_button_only(&self) -> bool#0.4.0 부터since 0.4.0소스source

마우스 왼쪽 단추만 터치로 넘기는지 반환.

Returns whether only the left mouse button is passed as touch.

반환Returnsbool 왼쪽 단추만이면 true. (처음은 false)true if only the left button. (initially false)

짝Counterpart: vanilla.js InputManager.isTouchFromLeftButtonOnly

메서드methodpub fn is_touch_button(&self, mouse_button: MouseButton) -> bool#0.4.0 부터since 0.4.0소스source

그 마우스 단추를 터치로 넘기는지. (플랫폼이 마우스 누름과 뗌에서 부른다)

Whether that mouse button is passed as touch. (called by the platform on mouse press and release)

mouse_buttonMouseButton
단추.Button.

반환Returnsbool 터치로 넘기면 true. (왼쪽 단추만으로 정했으면 Left 만 true)true if passed as touch. (only Left is true if set to the left button only)

메서드methodpub fn set_context_menu_prevented(&mut self, is_prevented: bool)#0.4.0 부터since 0.4.0소스source

캔버스의 오른쪽 클릭 메뉴를 막을지 설정. (처음은 참, 데스크탑 창에는 막을 메뉴가 없다)

Sets whether to block the canvas right-click menu. (initially true, desktop windows have no menu to block)

is_preventedbool
막으려면 true.true to block.

짝Counterpart: vanilla.js InputManager.setContextMenuPrevented

메서드methodpub fn is_context_menu_prevented(&self) -> bool#0.4.0 부터since 0.4.0소스source

캔버스의 오른쪽 클릭 메뉴를 막는지 반환.

Returns whether the canvas's right-click menu is blocked.

반환Returnsbool 막으면 true. (처음은 true)true if blocked. (initially true)

짝Counterpart: vanilla.js InputManager.isContextMenuPrevented

메서드methodpub fn find_touch_point(&self, identifier: i64) -> Option<&TouchPoint>#0.4.0 부터since 0.4.0소스source

닿아 있는 손가락 찾기. (없으면 None)

Finds a touching finger. (None if none)

identifieri64
플랫폼의 손가락 번호.The platform's finger number.

반환ReturnsOption<&TouchPoint> 그 번호의 닿아 있는 손가락. 없거나 이미 떨어졌으면 None.The touching finger with that number. None if it does not exist or has already lifted.

짝Counterpart: vanilla.js InputManager.findTouchPoint

예제Example번호로 손가락 자리 읽기Reading a finger position by number
use vanilla::{InputManager, Vector2};

let mut input_manager = InputManager::new();
input_manager.begin_touch_point(7, Vector2::create(1.0, 2.0), Vector2::create(3.0, 4.0));
let view_position = input_manager.find_touch_point(7).map(|touch_point| touch_point.view_position);
assert_eq!(view_position, Some(Vector2::create(3.0, 4.0)));
assert!(input_manager.find_touch_point(8).is_none());
메서드methodpub fn begin_touch_point(&mut self, identifier: i64, canvas_native_position: Vector2, view_position: Vector2)#0.4.0 부터since 0.4.0소스source

손가락이 닿음. (플랫폼이 부른다, 이미 있는 번호면 움직임으로 본다)

A finger touches. (called by the platform, treated as a move if the number already exists)

identifieri64
플랫폼의 손가락 번호.The platform's finger number.
canvas_native_positionVector2
창(캔버스) 안쪽 논리 좌표의 자리.Position in logical coordinates inside the window (canvas).
view_positionVector2
뷰 좌표의 자리.Position in view coordinates.

짝Counterpart: vanilla.js InputManager.beginTouchPoint

메서드methodpub fn move_touch_point(&mut self, identifier: i64, canvas_native_position: Vector2, view_position: Vector2)#0.4.0 부터since 0.4.0소스source

손가락이 움직임. (이번 프레임에 닿은 손가락은 Began 그대로)

  • 닿아 있지 않은 번호면 아무것도 하지 않는다.

A finger moves. (a finger that touched this frame stays Began)

  • Does nothing if the number is not touching.
identifieri64
플랫폼의 손가락 번호.The platform's finger number.
canvas_native_positionVector2
창(캔버스) 안쪽 논리 좌표의 새 자리.New position in logical coordinates inside the window (canvas).
view_positionVector2
뷰 좌표의 새 자리.New position in view coordinates.

짝Counterpart: vanilla.js InputManager.moveTouchPoint

메서드methodpub fn end_touch_point(&mut self, identifier: i64, canvas_native_position: Vector2, view_position: Vector2, is_cancelled: bool)#0.4.0 부터since 0.4.0소스source

손가락이 떨어짐. (닿은 목록에서 빼서 이번 프레임의 떨어진 목록에 둔다)

  • 닿아 있지 않은 번호면 아무것도 하지 않는다.

A finger lifts. (removed from the touching list and put in this frame's lifted list)

  • Does nothing if the number is not touching.
identifieri64
플랫폼의 손가락 번호.The platform's finger number.
canvas_native_positionVector2
뗀 자리. (창 안쪽 논리 좌표)Lift position. (logical coordinates inside the window)
view_positionVector2
뗀 자리. (뷰 좌표)Release position. (view coordinates)
is_cancelledbool
취소면 true(단계 Cancelled), 뗌이면 false(단계 Ended).true if cancelled (phase Cancelled), false if released (phase Ended).

짝Counterpart: vanilla.js InputManager.endTouchPoint

메서드methodpub fn get_ended_touch_points(&self) -> &[TouchPoint]#0.4.0 부터since 0.4.0소스source

이번 프레임에 떨어진 손가락 목록. (단계는 Ended, Cancelled, 자리는 뗀 자리)

List of fingers lifted this frame. (phase is Ended, Cancelled, position is the lift position)

반환Returns&[TouchPoint] 지난 프레임 끝 뒤로 떨어진 손가락들. (뗀 차례)Fingers lifted since the end of the last frame. (in lift order)

짝Counterpart: vanilla.js InputManager.getEndedTouchPoints

메서드methodpub fn set_touch_points(&mut self, touch_points: Vec<TouchPoint>)#0.4.0 부터since 0.4.0소스source

닿아 있는 손가락 목록 설정. (통째로 바꾼다, 단계는 넘긴 그대로)

Sets the list of touching fingers. (replaces it whole, phases as passed)

touch_pointsVec<TouchPoint>
새 손가락 목록.New finger list.
메서드methodpub fn get_touch_points(&self) -> &[TouchPoint]#0.4.0 부터since 0.4.0소스source

닿아 있는 손가락 목록. (닿은 차례, 단계는 Began, Moved, Stationary)

List of touching fingers. (in touch order, phase is Began, Moved, Stationary)

반환Returns&[TouchPoint] 닿아 있는 손가락들. 없으면 빈 조각.Touching fingers. Empty slice if none.

짝Counterpart: vanilla.js InputManager.getTouchPoints

메서드methodpub fn set_touch_input(&mut self, is_touch_input: bool)#0.4.0 부터since 0.4.0소스source

마지막 입력이 손가락인지 설정. (플랫폼이 부른다)

Sets whether the last input was a finger. (called by the platform)

is_touch_inputbool
손가락이면 true, 마우스면 false.true for a finger, false for a mouse.
메서드methodpub fn is_touch_input(&self) -> bool#0.4.0 부터since 0.4.0소스source

마지막 입력이 손가락인지. (마우스면 false, 처음에는 기기가 손가락이 주된 입력인지로. 원본 CameraGestures.isTouchInput 과 같다)

Whether the last input was a finger. (false for a mouse, initially whether the device's main input is fingers. Same as the original CameraGestures.isTouchInput)

반환Returnsbool 마지막 입력이 손가락이면 true.true if the last input was a finger.

짝Counterpart: vanilla.js InputManager.isTouchInput

메서드methodpub fn set_wheel_with_ctrl(&mut self, is_wheel_with_ctrl: bool)#0.4.0 부터since 0.4.0소스source

마지막 휠을 Ctrl 과 함께 굴렸는지 설정. (노트북 터치패드의 오므리기도 Ctrl 휠로 온다)

Sets whether the last wheel was rolled with Ctrl. (a laptop touchpad pinch also comes as a Ctrl wheel)

is_wheel_with_ctrlbool
Ctrl 과 함께였으면 true.true if with Ctrl.

짝Counterpart: vanilla.js InputManager.setWheelWithCtrl

메서드methodpub fn is_wheel_with_ctrl(&self) -> bool#0.4.0 부터since 0.4.0소스source

마지막 휠을 Ctrl 과 함께 굴렸는지.

Whether the last wheel was rolled with Ctrl.

반환Returnsbool 마지막 휠 사건이 Ctrl 과 함께였으면 true. (프레임 끝에 지우지 않는다)true if the last wheel event was with Ctrl. (not cleared at the end of the frame)

짝Counterpart: vanilla.js InputManager.isWheelWithCtrl

메서드methodpub fn set_touch_pressed(&mut self, value: bool)#0.3.2 부터since 0.3.2소스source

터치 상태. (Pressed / Released / Cancelled 는 그 프레임에만 켜진다, Moved 는 누른 동안 켜진다 set_touch_moved)

Touch state. (Pressed / Released / Cancelled are on only for that frame, Moved is on while pressed, set_touch_moved)

valuebool
이번 프레임에 눌렀으면 true.true if pressed this frame.

짝Counterpart: vanilla.js InputManager.setTouchPressed

메서드methodpub fn set_touch_released(&mut self, value: bool)#0.3.2 부터since 0.3.2소스source

이번 프레임에 뗐는지 설정. (플랫폼이 켜고 엔진이 프레임 끝에 끈다)

Sets whether released this frame. (the platform turns it on and the engine turns it off at the end of the frame)

valuebool
이번 프레임에 뗐으면 true.true if released this frame.

짝Counterpart: vanilla.js InputManager.setTouchReleased

메서드methodpub fn set_touch_cancelled(&mut self, value: bool)#0.3.2 부터since 0.3.2소스source

이번 프레임에 터치가 취소됐는지 설정. (플랫폼이 켜고 엔진이 프레임 끝에 끈다)

Sets whether the touch was cancelled this frame. (the platform turns it on and the engine turns it off at the end of the frame)

valuebool
이번 프레임에 취소됐으면 true.true if cancelled this frame.

짝Counterpart: vanilla.js InputManager.setTouchCancelled

메서드methodpub fn set_touch_moved(&mut self, value: bool)#0.3.2 부터since 0.3.2소스source

누르고 있는지. (원본처럼 누를 때 켜고 뗄 때 끈다, 프레임마다 지우지 않는다, 원본 주석 "입력시 뗄 때까지 계속 눌림")

Whether being held. (on when pressed and off when released like the original, not cleared every frame, the original comment "pressed continuously until released after input")

valuebool
누를 때 true, 떼거나 취소될 때 false.true when pressed, false when released or cancelled.

짝Counterpart: vanilla.js InputManager.setTouchMoved

메서드methodpub fn is_touch_pressed(&self) -> bool#0.3.2 부터since 0.3.2소스source

이번 프레임에 터치를 눌렀는지.

Whether the touch was pressed this frame.

반환Returnsbool 이번 프레임에 눌렀으면 true. (첫 손가락이나 터치로 넘기는 마우스 단추)true if pressed this frame. (the first finger or a mouse button passed as touch)

짝Counterpart: vanilla.js InputManager.isTouchPressed

예제Example누름, 누르고 있음, 뗌 읽기Reading press, hold and release
use vanilla::InputManager;

let mut input_manager = InputManager::new();
input_manager.set_touch_pressed(true);
input_manager.set_touch_moved(true);
input_manager.set_touch_down(true);
assert!(input_manager.is_touch_pressed());
input_manager.set_touch_pressed(false);
assert!(input_manager.is_touch_moved());
assert!(input_manager.is_touch_down());
input_manager.set_touch_moved(false);
input_manager.set_touch_released(true);
input_manager.set_touch_down(false);
assert!(input_manager.is_touch_released());
assert!(!input_manager.is_touch_down());
메서드methodpub fn is_touch_released(&self) -> bool#0.3.2 부터since 0.3.2소스source

이번 프레임에 터치를 뗐는지.

Whether the touch was released this frame.

반환Returnsbool 이번 프레임에 뗐으면 true.true if released this frame.

짝Counterpart: vanilla.js InputManager.isTouchReleased

메서드methodpub fn is_touch_cancelled(&self) -> bool#0.3.2 부터since 0.3.2소스source

이번 프레임에 터치가 취소됐는지.

Whether the touch was cancelled this frame.

반환Returnsbool 이번 프레임에 취소됐으면 true. (플랫폼이 손가락 입력을 거둔 때)true if cancelled this frame. (when the platform withdrew finger input)

짝Counterpart: vanilla.js InputManager.isTouchCancelled

메서드methodpub fn is_touch_moved(&self) -> bool#0.3.2 부터since 0.3.2소스source

누르고 있는지. (원본 isTouchMoved, 이름과 달리 움직이지 않아도 누른 동안 참)

Whether being held. (the original isTouchMoved, true while pressed even without moving, despite the name)

반환Returnsbool 누른 프레임부터 떼거나 취소될 때까지 true.true from the pressed frame until released or cancelled.

짝Counterpart: vanilla.js InputManager.isTouchMoved

메서드methodpub fn set_touch_down(&mut self, value: bool)#0.3.2 부터since 0.3.2소스source

터치가 눌린 채인지. (러스트 판에서 더한 것. 눌린 동안 계속 켜져 있다)

Whether the touch is held. (added in the Rust version. Stays on while pressed)

valuebool
누를 때 true, 떼거나 취소될 때 false.true when pressed, false when released or cancelled.

짝Counterpart: vanilla.js InputManager.setTouchDown

메서드methodpub fn is_touch_down(&self) -> bool#0.3.2 부터since 0.3.2소스source

터치가 눌린 채인지.

Whether the touch is held.

반환Returnsbool 누른 프레임부터 떼거나 취소될 때까지 true. (누른 채 움직이지 않아도)true from the pressed frame until released or cancelled. (even if held without moving)

짝Counterpart: vanilla.js InputManager.isTouchDown

메서드methodpub fn set_canvas_native_input_position(&mut self, position: Vector2)#0.3.2 부터since 0.3.2소스source

입력 위치. (창 안쪽 논리 좌표 / 뷰 좌표)

  • 창 안쪽 논리 좌표의 입력 위치 설정. (플랫폼이 마우스와 첫 손가락에서 부른다)

Input position. (logical coordinates inside the window / view coordinates)

  • Sets the input position in logical coordinates inside the window. (called by the platform for the mouse and first finger)
positionVector2
캔버스 왼쪽 위가 0 인 논리 픽셀 자리.Position in logical pixels with 0 at the top left of the canvas.

짝Counterpart: vanilla.js InputManager.setCanvasNativeInputPosition

메서드methodpub fn get_canvas_native_input_position(&self) -> Vector2#0.3.2 부터since 0.3.2소스source

창 안쪽 논리 좌표의 입력 위치.

Input position in logical coordinates inside the window.

반환ReturnsVector2 마지막 마우스나 첫 손가락의 자리. (캔버스 왼쪽 위가 0, 논리 픽셀, 처음은 0, 0)Position of the last mouse or first finger. (0 at the top left of the canvas, logical pixels, initially 0, 0)

짝Counterpart: vanilla.js InputManager.getCanvasNativeInputPosition

메서드methodpub fn set_view_input_position(&mut self, position: Vector2)#0.3.2 부터since 0.3.2소스source

뷰 좌표의 입력 위치 설정. (플랫폼이 마우스와 첫 손가락에서 부른다)

Sets the input position in view coordinates. (called by the platform for the mouse and first finger)

positionVector2
뷰 좌표의 자리.Position in view coordinates.

짝Counterpart: vanilla.js InputManager.setViewInputPosition

메서드methodpub fn get_view_input_position(&self) -> Vector2#0.3.2 부터since 0.3.2소스source

뷰 좌표의 입력 위치. (씬의 touch_press 들이 받는 자리)

Input position in view coordinates. (the position the scene's touch_press functions receive)

반환ReturnsVector2 마지막 마우스나 첫 손가락의 뷰 좌표 자리. (처음은 0, 0)View coordinate position of the last mouse or first finger. (initially 0, 0)

짝Counterpart: vanilla.js InputManager.getViewInputPosition

메서드methodpub fn update_all_gamepads(&mut self)#0.3.2 부터since 0.3.2소스source

모든 게임패드 갱신.

Updates all gamepads.

짝Counterpart: vanilla.js InputManager.updateAllGamepads

메서드methodpub fn connect_gamepad(&mut self, gamepad: &Gamepad)#0.3.2 부터since 0.3.2소스source

게임패드 연결.

Gamepad connected.

gamepad&Gamepad
붙일 패드. (같은 index 가 이미 붙어 있으면 건너뛴다)Pad to attach. (skipped if the same index is already attached)

짝Counterpart: vanilla.js InputManager.connectGamepad

메서드methodpub fn disconnect_gamepad(&mut self, gamepad: &Gamepad)#0.3.2 부터since 0.3.2소스source

게임패드 연결 해제.

Gamepad disconnected.

gamepad&Gamepad
뗄 패드. (index 로 찾는다, 붙어 있지 않으면 건너뛴다)Pad to detach. (found by index, skipped if not attached)

짝Counterpart: vanilla.js InputManager.disconnectGamepad

메서드methodpub fn get_gamepad_manager(&self) -> &GamepadManager#0.3.2 부터since 0.3.2소스source

게임패드 매니저 반환.

Returns the gamepad manager.

반환Returns&GamepadManager 들고 있는 게임패드 관리자.The held gamepad manager.

짝Counterpart: vanilla.js InputManager.getGamepadManager

메서드methodpub fn get_gamepad_manager_mut(&mut self) -> &mut GamepadManager#0.3.2 부터since 0.3.2소스source

게임패드 매니저 반환. (바꿀 때: set_callback, connect 들)

Returns the gamepad manager. (for changes: set_callback, connect and such)

반환Returns&mut GamepadManager 들고 있는 게임패드 관리자. (바꿀 수 있게)The held gamepad manager. (mutable)

짝Counterpart: vanilla.js InputManager.getGamepadManager

메서드methodpub fn get_text_input(&self) -> &TextInput#0.3.2 부터since 0.3.2소스source

글 입력 줄 반환. (입력 필드가 꺼내 쓰고 상태를 올린다. &self 로 된다)

Returns the text input queue. (input fields take from it and update its state. Works with &self)

반환Returns&TextInput 들고 있는 글 입력 줄.The held text input queue.

메서드methodpub fn get_text_input_mut(&mut self) -> &mut TextInput#0.3.2 부터since 0.3.2소스source

글 입력 줄 반환. (플랫폼이 이벤트를 넣을 때)

Returns the text input queue. (for the platform putting in events)

반환Returns&mut TextInput 들고 있는 글 입력 줄. (바꿀 수 있게)The held text input queue. (mutable)

메서드methodpub fn set_last_input_device(&mut self, input_device: InputDevice)#0.4.0 부터since 0.4.0소스source

마지막으로 쓴 입력 장치 설정. (플랫폼이 키, 마우스, 손가락 입력에서 부른다, 게임이 바깥 입력원을 쓸 때도)

Sets the last used input device. (called by the platform on key, mouse and finger input, also when a game uses an outside input source)

input_deviceInputDevice
장치.Device.

짝Counterpart: vanilla.js InputManager.setLastInputDevice

메서드methodpub fn get_last_input_device(&self) -> InputDevice#0.4.0 부터since 0.4.0소스source

마지막으로 쓴 입력 장치. (처음은 손가락 기기면 Touch, 아니면 Keyboard)

Last used input device. (initially Touch on finger devices, otherwise Keyboard)

반환ReturnsInputDevice 마지막으로 쓴 장치. (단추 안내를 키보드나 패드 표기로 가를 때)Last used device. (for choosing keyboard or pad notation for button hints)

짝Counterpart: vanilla.js InputManager.getLastInputDevice

예제Example마지막 장치에 따라 안내 고르기Choosing hints by the last device
use vanilla::{GamepadKind, InputDevice, InputManager};

let mut input_manager = InputManager::new();
input_manager.set_last_input_device(InputDevice::Gamepad);
input_manager.set_last_gamepad_kind(GamepadKind::PlayStation);
let hint = match input_manager.get_last_input_device() {
	InputDevice::Gamepad => {
		match input_manager.get_last_gamepad_kind() {
			GamepadKind::PlayStation => {
				"Cross"
			}
			_ => {
				"A"
			}
		}
	}
	_ => {
		"Enter"
	}
};
assert_eq!(hint, "Cross");
메서드methodpub fn set_last_gamepad_kind(&mut self, gamepad_kind: GamepadKind)#0.4.0 부터since 0.4.0소스source

마지막으로 쓴 게임패드의 종류 설정.

Sets the kind of the last used gamepad.

gamepad_kindGamepadKind
패드 종류.Pad kind.

짝Counterpart: vanilla.js InputManager.setLastGamepadKind

메서드methodpub fn get_last_gamepad_kind(&self) -> GamepadKind#0.4.0 부터since 0.4.0소스source

마지막으로 쓴 게임패드의 종류. (단추를 누르거나 스틱을 크게 기울인 패드의 이름으로 가른다, 처음은 Other)

Kind of the last used gamepad. (told from the name of the pad that pressed a button or tilted a stick far, initially Other)

반환ReturnsGamepadKind 마지막으로 쓴 패드의 종류.Kind of the last used pad.

짝Counterpart: vanilla.js InputManager.getLastGamepadKind

메서드methodpub fn set_prevented_keys(&mut self, keys: &[&str])#0.4.0 부터since 0.4.0소스source

브라우저 기본 동작을 막을 키 설정. (KeyboardEvent.code 목록, 웹에서만 뜻이 있다, 글자 입력칸에 쓰는 중이면 막지 않는다)

  • 앞서 정한 목록을 통째로 바꾼다.

Sets the keys whose browser default action is blocked. (a KeyboardEvent.code list, meaningful only on the web, not blocked while typing in a text field)

  • Replaces the previously set list whole.
keys&[&str]
막을 키 이름 목록. (KeyCode 의 값)List of key names to block. (KeyCode values)

짝Counterpart: vanilla.js InputManager.setPreventedKeys

예제Example탭과 스페이스의 기본 동작 막기Blocking the default actions of Tab and Space
use vanilla::{InputManager, KeyCode};

let mut input_manager = InputManager::new();
input_manager.set_prevented_keys(&[KeyCode::TAB, KeyCode::SPACE]);
assert!(input_manager.is_key_prevented("Tab"));
assert!(!input_manager.is_key_prevented(KeyCode::F5));
assert_eq!(input_manager.get_prevented_keys().len(), 2);
메서드methodpub fn get_prevented_keys(&self) -> Vec<String>#0.4.0 부터since 0.4.0소스source

브라우저 기본 동작을 막을 키 목록.

List of keys whose browser default action is blocked.

반환ReturnsVec<String> 막을 키 이름의 사본. (차례는 정해지지 않는다)Copy of the key names to block. (order is undefined)

짝Counterpart: vanilla.js InputManager.getPreventedKeys

메서드methodpub fn is_key_prevented(&self, key: &str) -> bool#0.4.0 부터since 0.4.0소스source

그 키의 기본 동작을 막는지.

Whether the key's default behavior is blocked.

key&str
키 이름. (KeyboardEvent.code)Key name. (KeyboardEvent.code)

반환Returnsbool 막을 키 목록에 있으면 true.true if in the list of keys to block.

짝Counterpart: vanilla.js InputManager.isKeyPrevented

메서드methodpub fn is_typing_in_text_field(&self) -> bool#0.4.0 부터since 0.4.0소스source

글자 입력칸에 쓰는 중인지. (엔진 입력 필드의 포커스, 웹은 문서의 초점이 글자 input, textarea, contenteditable, select 에 있음)

Whether typing in a text field. (engine input field focus, on the web the document focus is on a text input, textarea, contenteditable, select)

반환Returnsbool 엔진 입력 필드가 활성이거나 웹 문서의 초점이 글자 입력칸에 있으면 true.true if an engine input field is active or the web document focus is on a text field.

짝Counterpart: vanilla.js InputManager.isTypingInTextField

메서드methodpub fn get_input_actions(&self) -> &InputActions#0.4.0 부터since 0.4.0소스source

입력 동작. (동작 이름에 키, 패드 단추, 축을 묶어 읽는다, tick 마다 갱신된다)

Input actions. (binds keys, pad buttons and axes to action names to read them, updated every tick)

반환Returns&InputActions 들고 있는 입력 동작.The held input actions.

짝Counterpart: vanilla.js InputManager.getInputActions

메서드methodpub fn get_input_actions_mut(&mut self) -> &mut InputActions#0.4.0 부터since 0.4.0소스source

입력 동작. (묶기, 반복, 바깥 입력원)

Input actions. (binding, repeat, outside input sources)

반환Returns&mut InputActions 들고 있는 입력 동작. (바꿀 수 있게)The held input actions. (mutable)

짝Counterpart: vanilla.js InputManager.getInputActions

MouseButtonenum traits Clone, Copy, PartialEq, Eq, Hash, Debug

짝Counterpart: vanilla.js MouseButton소스source

마우스 단추.

Mouse button.

이름Name설명Description
Left왼쪽 단추. (칸 번호 0)Left button. (slot index 0)
Middle가운데 단추. (휠 누름, 칸 번호 1)Middle button. (wheel press, slot index 1)
Right오른쪽 단추. (칸 번호 2)Right button. (slot index 2)
메서드methodpub fn get_index(&self) -> usize#0.4.0 부터since 0.4.0소스source

단추 칸 번호.

Button slot index.

반환Returnsusize Left 0, Middle 1, Right 2.

TouchPhaseenum traits Clone, Copy, PartialEq, Eq, Hash, Debug

짝Counterpart: vanilla.js TouchPhase소스source

손가락의 단계. (Began 이번 프레임에 닿음, Moved 움직임, Stationary 가만히, Ended 뗌, Cancelled 취소)

Finger phase. (Began touched this frame, Moved moved, Stationary still, Ended released, Cancelled cancelled)

이름Name설명Description
Began이번 프레임에 닿음. (닿은 프레임에는 움직여도 Began 그대로)Touched this frame. (stays Began in the frame it touched even if it moves)
Moved지난 프레임 뒤로 움직임.Moved since the last frame.
Stationary닿은 채 가만히. (프레임 끝 update_frame_snapshot 이 남은 손가락을 이것으로 바꾼다)Touching and still. (update_frame_snapshot at the end of the frame changes remaining fingers to this)
Ended떨어짐. (get_ended_touch_points 에 한 프레임 남는다)Lifted. (stays in get_ended_touch_points for one frame)
Cancelled취소됨. (플랫폼이 손가락 입력을 거둔 것, get_ended_touch_points 에 한 프레임 남는다)Cancelled. (the platform withdrew the finger input, stays in get_ended_touch_points for one frame)

InputDeviceenum traits Clone, Copy, PartialEq, Eq, Hash, Debug

짝Counterpart: vanilla.js InputDevice소스source

마지막으로 쓴 입력 장치.

Last used input device.

이름Name설명Description
Keyboard키보드.Keyboard.
Mouse마우스.Mouse.
Touch손가락. (터치 화면)Finger. (touch screen)
Gamepad게임패드. (바깥 입력원 InputActionSource 가 넣은 패드 입력도)Gamepad. (including pad input put in by the outside input source InputActionSource)