vanilladocs
vanillapunch.com
API / core/inputmanager

core/inputmanager

입력 매니저.

Input manager.

TouchPointextends Object

짝Counterpart: vanilla-engine TouchPoint

손가락 하나. (identifier 는 브라우저의 Touch.identifier, 자리는 캔버스 기준과 뷰 기준)

One finger. (identifier is the browser's Touch.identifier, positions are canvas-based and view-based)

예제Example닿은 손가락과 뗀 손가락 읽기Read touching and lifted fingers
import { Engine, EngineConfiguration, Scene, TouchPhase } from "./build/vanilla.js";

class MainScene extends Scene {
	tick(timeDelta) {
		super.tick(timeDelta);
		const engine = this.getEngine();
		const inputManager = engine.getInputManager();
		const touchPoints = inputManager.getTouchPoints();
		for (const touchPoint of touchPoints) {
			if (touchPoint.phase === TouchPhase.began) {
				console.log(touchPoint.identifier, touchPoint.viewPosition.x, touchPoint.viewPosition.y);
			}
		}
		const endedTouchPoints = inputManager.getEndedTouchPoints();
		for (const touchPoint of endedTouchPoints) {
			console.log(touchPoint.identifier, touchPoint.phase);
		}
	}
}

const engineConfiguration = new EngineConfiguration();
const engine = new Engine(engineConfiguration);
engine.run(new MainScene());
생성자constructorconstructor(identifier, phase, canvasNativePosition, viewPosition)#0.4.0 부터since 0.4.0소스source

생성.

Constructor.

identifiernumber
손가락 번호. (Touch.identifier)Finger number. (Touch.identifier)
phasestring
TouchPhase 의 값.A TouchPhase value.
canvasNativePositionVector2
캔버스 왼쪽 위 기준 자리. (CSS 픽셀)Position from the canvas top-left. (CSS pixels)
viewPositionVector2
뷰 좌표의 자리.Position in view coordinates.
필드fieldidentifier#0.4.0 부터since 0.4.0소스source

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

Finger number. (Stays the same while touching)

반환Returnsnumber

짝Counterpart: vanilla-engine TouchPoint.identifier

필드fieldphase#0.4.0 부터since 0.4.0소스source

TouchPhase 의 값.

A TouchPhase value.

반환Returnsstring

짝Counterpart: vanilla-engine TouchPoint.phase

필드fieldcanvasNativePosition#0.4.0 부터since 0.4.0소스source

캔버스 왼쪽 위 기준 CSS 픽셀 자리.

CSS pixel position relative to the canvas top-left.

반환ReturnsVector2

짝Counterpart: vanilla-engine TouchPoint.canvas_native_position

필드fieldviewPosition#0.4.0 부터since 0.4.0소스source

뷰(기준 해상도) 자리.

View (reference resolution) position.

반환ReturnsVector2

짝Counterpart: vanilla-engine TouchPoint.view_position

InputManagerextends Object

짝Counterpart: vanilla-engine InputManager

입력 매니저.

Input manager.

예제Example키와 마우스 단추 읽기Read keys and mouse buttons
import { Engine, EngineConfiguration, Scene, MouseButton } from "./build/vanilla.js";

class MainScene extends Scene {
	tick(timeDelta) {
		super.tick(timeDelta);
		const engine = this.getEngine();
		const inputManager = engine.getInputManager();
		if (inputManager.isKeyJustPressed("Space")) {
			console.log("jump");
		}
		if (inputManager.isKeyPressed("ArrowRight")) {
			console.log("move right");
		}
		if (inputManager.isMouseButtonJustPressed(MouseButton.right)) {
			const viewInputPosition = inputManager.getViewInputPosition();
			console.log(viewInputPosition.x, viewInputPosition.y);
		}
	}
}

const engineConfiguration = new EngineConfiguration();
const engine = new Engine(engineConfiguration);
const inputManager = engine.getInputManager();
inputManager.setPreventedKeys(["Space", "Tab"]);
inputManager.setTouchFromLeftButtonOnly(true);
engine.run(new MainScene());
생성자constructorconstructor(engine)#0.0.8 부터since 0.0.8소스source

생성.

Constructor.

engineEngine
이 매니저를 가진 엔진. (게임패드 매니저에 넘기고 글자 입력칸을 볼 때 쓴다)The engine that owns this manager. (passed to the gamepad manager and used to check text inputs)

짝Counterpart: vanilla-engine InputManager.new

메서드methodtick(timeDelta)#0.0.8 부터since 0.0.8소스source

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

Update. (Gamepad polling, sets the last device to gamepad if a pad was used, updates input actions)

timeDeltanumber
지난 프레임부터의 시간. (초)Time since the last frame. (Seconds)

짝Counterpart: vanilla-engine InputManager.tick

메서드methodclear()#0.2.0 부터since 0.2.0소스source

모든 입력 상태를 초기 상태로 되돌림. (창이 포커스를 잃을 때와 페이지 프로세스 복원 시 stuck touch/key 방지용)

Resets all input states to the initial state. (To prevent stuck touch/key when the window loses focus and when the page process is restored)

짝Counterpart: vanilla-engine InputManager.clear

메서드methodaddWheelDelta(deltaX, deltaY)#0.2.1 부터since 0.2.1소스source

마우스 휠 누적값.

  • addWheelDelta 로 들어온 값을 한 프레임 누적해서 들고 있다가, 프레임 종료 시 엔진이 clearWheelDelta() 로 비운다.

Mouse wheel accumulated value.

  • Accumulates the values coming in through addWheelDelta for one frame, and at frame end the engine clears them with clearWheelDelta().
deltaXnumber
더할 휠 가로 값. (WheelEvent.deltaX)Horizontal wheel amount to add. (WheelEvent.deltaX)
deltaYnumber
더할 휠 세로 값. (WheelEvent.deltaY, 아래로 굴리면 양수)Vertical wheel amount to add. (WheelEvent.deltaY, positive when scrolling down)

짝Counterpart: vanilla-engine InputManager.add_wheel_delta

메서드methodgetWheelDeltaX()#0.2.1 부터since 0.2.1소스source

이번 프레임에 쌓인 휠 가로 값 반환.

Returns the horizontal wheel amount accumulated this frame.

반환Returnsnumber 휠 가로 값. (WheelEvent.deltaX 의 합)Horizontal wheel amount. (sum of WheelEvent.deltaX)

짝Counterpart: vanilla-engine InputManager.get_wheel_delta_x

메서드methodgetWheelDeltaY()#0.2.1 부터since 0.2.1소스source

이번 프레임에 쌓인 휠 세로 값 반환.

Returns the vertical wheel amount accumulated this frame.

반환Returnsnumber 휠 세로 값. (WheelEvent.deltaY 의 합, 아래로 굴리면 양수)Vertical wheel amount. (sum of WheelEvent.deltaY, positive when scrolling down)

짝Counterpart: vanilla-engine InputManager.get_wheel_delta_y

메서드methodhasWheelDelta()#0.2.1 부터since 0.2.1소스source

이번 프레임에 쌓인 휠 값이 있는지.

Whether any wheel amount accumulated this frame.

반환Returnsboolean 가로나 세로가 0 이 아니면 참.True if the horizontal or vertical amount is not 0.

짝Counterpart: vanilla-engine InputManager.has_wheel_delta

메서드methodclearWheelDelta()#0.2.1 부터since 0.2.1소스source

쌓인 휠 값 비우기. (엔진이 프레임 끝에 부른다)

Clears the accumulated wheel amount. (the engine calls this at the end of the frame)

짝Counterpart: vanilla-engine InputManager.clear_wheel_delta

메서드methodsetWheelWithCtrl(isWheelWithCtrl)#0.4.0 부터since 0.4.0소스source

마지막 휠을 Ctrl 과 함께 굴렸는지 설정. (엔진이 wheel 에서 부른다, 노트북 터치패드의 오므리기도 Ctrl 휠로 온다)

Sets whether the last wheel was rolled with Ctrl. (The engine calls it from wheel, laptop touchpad pinches also arrive as Ctrl wheel)

isWheelWithCtrlboolean
Ctrl 과 함께 굴렸는지.Whether it was scrolled with Ctrl.

짝Counterpart: vanilla-engine InputManager.set_wheel_with_ctrl

메서드methodisWheelWithCtrl()#0.4.0 부터since 0.4.0소스source

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

Returns whether the last wheel was rolled with Ctrl.

반환Returnsboolean Ctrl 과 함께 굴렸으면 참.True if it was scrolled with Ctrl.

짝Counterpart: vanilla-engine InputManager.is_wheel_with_ctrl

메서드methodpushKey(key)#0.0.8 부터since 0.0.8소스source

키 누름 여부 설정.

Sets whether a key is pressed.

keystring
누른 키 코드. (KeyboardEvent.code)Pressed key code. (KeyboardEvent.code)

짝Counterpart: vanilla-engine InputManager.push_key

메서드methodpopKey(key)#0.0.8 부터since 0.0.8소스source

키 뗌 여부 설정.

Sets whether a key is released.

keystring
뗀 키 코드. (KeyboardEvent.code)Released key code. (KeyboardEvent.code)

짝Counterpart: vanilla-engine InputManager.pop_key

메서드methodisKeyPressed(key)#0.0.8 부터since 0.0.8소스source

키 누름 여부 반환.

Returns whether a key is pressed.

keystring
키 코드. (KeyboardEvent.code, 예: "KeyW", "Space")Key code. (KeyboardEvent.code, e.g. "KeyW", "Space")

반환Returnsboolean 눌려 있으면 참.True if held down.

짝Counterpart: vanilla-engine InputManager.is_key_pressed

메서드methodisKeyJustPressed(key)#0.3.0 부터since 0.3.0소스source

이번 프레임에 방금 눌린 키인지 여부.

  • 게임마다 wasPressed 변수를 손으로 들고 다니던 것을 대신한다.
  • 지난 프레임 끝 뒤로 온 키 사건을 본다. 프레임 사이에 눌렀다 뗀 키도 참이다. (그때는 isKeyPressed 가 거짓이고 isKeyJustReleased 도 참)

Whether the key was just pressed this frame.

  • Replaces the wasPressed variable each game used to carry around by hand.
  • Looks at key events since the end of the last frame. A key pressed and released between frames is also true. (In that case isKeyPressed is false and isKeyJustReleased is also true)
keystring
키 코드. (KeyboardEvent.code, 예: "KeyW", "Space")Key code. (KeyboardEvent.code, e.g. "KeyW", "Space")

반환Returnsboolean 이번 프레임에 눌렸으면 참.True if pressed this frame.

짝Counterpart: vanilla-engine InputManager.is_key_just_pressed

메서드methodisKeyJustReleased(key)#0.3.0 부터since 0.3.0소스source

이번 프레임에 방금 떼어진 키인지 여부.

Whether the key was just released this frame.

keystring
키 코드. (KeyboardEvent.code, 예: "KeyW", "Space")Key code. (KeyboardEvent.code, e.g. "KeyW", "Space")

반환Returnsboolean 이번 프레임에 떼어졌으면 참.True if released this frame.

짝Counterpart: vanilla-engine InputManager.is_key_just_released

메서드methodupdateFrameSnapshot()#0.3.0 부터since 0.3.0소스source

프레임 스냅샷 갱신.

  • 엔진이 프레임 끝에서 부른다. 이번 프레임에 본 키와 마우스 단추의 눌림, 뗌을 비우고, 떨어진 손가락을 지우고 남은 손가락을 가만히로 둔다.

Updates the frame snapshot.

  • Called by the engine at frame end. Clears this frame's key and mouse button presses and releases, removes lifted fingers and sets the remaining fingers to stationary.

짝Counterpart: vanilla-engine InputManager.update_frame_snapshot

메서드methodsetTouchPressed(value)#0.0.8 부터since 0.0.8소스source

누름 여부 설정.

Sets whether pressed.

valueboolean
이번 프레임에 눌렀는지.Whether pressed this frame.

짝Counterpart: vanilla-engine InputManager.set_touch_pressed

메서드methodsetTouchReleased(value)#0.0.8 부터since 0.0.8소스source

뗌 여부 설정.

Sets whether released.

valueboolean
이번 프레임에 뗐는지.Whether released this frame.

짝Counterpart: vanilla-engine InputManager.set_touch_released

메서드methodsetTouchCancelled(value)#0.2.0 부터since 0.2.0소스source

취소 여부 설정.

Sets whether cancelled.

valueboolean
이번 프레임에 취소됐는지.Whether cancelled this frame.

짝Counterpart: vanilla-engine InputManager.set_touch_cancelled

메서드methodsetTouchMoved(value)#0.0.8 부터since 0.0.8소스source

누르고 있는 중인지 여부 설정.

Sets whether being held down.

valueboolean
누르고 있는 중인지.Whether it is being held.

짝Counterpart: vanilla-engine InputManager.set_touch_moved

메서드methodisTouchPressed()#0.0.8 부터since 0.0.8소스source

누름 여부 반환.

Returns whether pressed.

반환Returnsboolean 이번 프레임에 눌렀으면 참.True if pressed this frame.

짝Counterpart: vanilla-engine InputManager.is_touch_pressed

메서드methodisTouchReleased()#0.0.8 부터since 0.0.8소스source

뗌 여부 반환.

Returns whether released.

반환Returnsboolean 이번 프레임에 뗐으면 참.True if released this frame.

짝Counterpart: vanilla-engine InputManager.is_touch_released

메서드methodisTouchCancelled()#0.2.0 부터since 0.2.0소스source

취소 여부 반환.

Returns whether cancelled.

반환Returnsboolean 이번 프레임에 취소됐으면 참.True if cancelled this frame.

짝Counterpart: vanilla-engine InputManager.is_touch_cancelled

메서드methodisTouchMoved()#0.0.8 부터since 0.0.8소스source

누르고 있는 중인지 여부 반환.

Returns whether being held down.

반환Returnsboolean 누르고 있는 중이면 참.True if it is being held.

짝Counterpart: vanilla-engine InputManager.is_touch_moved

메서드methodsetTouchDown(value)#0.4.0 부터since 0.4.0소스source

터치가 눌린 채인지 설정. (엔진이 누름과 뗌에서 부른다)

Sets whether the touch is held down. (The engine calls it on press and release)

valueboolean
눌린 채인지.Whether it is held down.

짝Counterpart: vanilla-engine InputManager.set_touch_down

메서드methodisTouchDown()#0.4.0 부터since 0.4.0소스source

터치가 눌린 채인지 반환. (누른 프레임부터 뗄 때까지 참, 누른 채 움직이지 않아도 참)

Returns whether the touch is held down. (True from the press frame until release, true even when held without moving)

반환Returnsboolean 눌린 채면 참.True if it is held down.

짝Counterpart: vanilla-engine InputManager.is_touch_down

메서드methodsetCanvasNativeInputPosition(position)#0.0.8 부터since 0.0.8소스source

canvasNativeSize 기반 입력 위치 갱신.

Updates the canvasNativeSize based input position.

positionVector2
캔버스 왼쪽 위 기준 자리. (CSS 픽셀, 받은 벡터를 반올림해 그대로 담는다)Position from the canvas top-left. (CSS pixels, the given vector is rounded in place and stored as is)

짝Counterpart: vanilla-engine InputManager.set_canvas_native_input_position

메서드methodgetCanvasNativeInputPosition()#0.0.8 부터since 0.0.8소스source

canvasNativeSize 기반 입력 위치 반환.

Returns the canvasNativeSize based input position.

반환ReturnsVector2 캔버스 왼쪽 위 기준 입력 위치. (CSS 픽셀, 정수)Input position from the canvas top-left. (CSS pixels, integers)

짝Counterpart: vanilla-engine InputManager.get_canvas_native_input_position

메서드methodsetViewInputPosition(position)#0.0.8 부터since 0.0.8소스source

뷰의 입력 위치 갱신.

Updates the view's input position.

positionVector2
뷰 좌표의 자리. (받은 벡터를 반올림해 그대로 담는다)Position in view coordinates. (the given vector is rounded in place and stored as is)

짝Counterpart: vanilla-engine InputManager.set_view_input_position

메서드methodgetViewInputPosition()#0.0.8 부터since 0.0.8소스source

뷰의 입력 위치 반환.

Returns the view's input position.

반환ReturnsVector2 뷰 좌표의 입력 위치. (정수)Input position in view coordinates. (integers)

짝Counterpart: vanilla-engine InputManager.get_view_input_position

메서드methodupdateAllGamepads()#0.0.8 부터since 0.0.8소스source

모든 게임패드 갱신.

Updates all gamepads.

짝Counterpart: vanilla-engine InputManager.update_all_gamepads

메서드methodconnectGamepad(gamepad)#0.0.9 부터since 0.0.9소스source

게임패드 연결.

Gamepad connected.

gamepadGamepad
연결된 게임패드. (gamepadconnected 사건의 Gamepad)The connected gamepad. (Gamepad of the gamepadconnected event)

짝Counterpart: vanilla-engine InputManager.connect_gamepad

메서드methoddisconnectGamepad(gamepad)#0.0.9 부터since 0.0.9소스source

게임패드 연결 해제.

Gamepad disconnected.

gamepadGamepad
연결이 끊긴 게임패드. (gamepaddisconnected 사건의 Gamepad)The disconnected gamepad. (Gamepad of the gamepaddisconnected event)

짝Counterpart: vanilla-engine InputManager.disconnect_gamepad

메서드methodgetGamepadManager()#0.0.9 부터since 0.0.9소스source

게임패드 매니저 반환.

Returns the gamepad manager.

반환ReturnsGamepadManager 게임패드 매니저.The gamepad manager.

짝Counterpart: vanilla-engine InputManager.get_gamepad_manager

메서드methodsetMouseButtonDown(mouseButton, isDown)#0.4.0 부터since 0.4.0소스source

마우스 단추 눌림 설정. (엔진이 mousedown, mouseup 에서 부른다)

Sets the mouse button pressed state. (The engine calls it from mousedown, mouseup)

mouseButtonnumber
MouseButton 의 값.A MouseButton value.
isDownboolean
눌렸으면 참.True if pressed.

짝Counterpart: vanilla-engine InputManager.set_mouse_button_down

메서드methodisMouseButtonDown(mouseButton)#0.4.0 부터since 0.4.0소스source

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

Whether the mouse button is pressed.

mouseButtonnumber
MouseButton 의 값.A MouseButton value.

반환Returnsboolean 눌려 있으면 참.True if held down.

짝Counterpart: vanilla-engine InputManager.is_mouse_button_down

메서드methodisMouseButtonJustPressed(mouseButton)#0.4.0 부터since 0.4.0소스source

이번 프레임에 마우스 단추를 눌렀는지. (프레임 사이에 눌렀다 뗀 것도 참)

Whether the mouse button was pressed this frame. (Pressed and released between frames is also true)

mouseButtonnumber
MouseButton 의 값.A MouseButton value.

반환Returnsboolean 이번 프레임에 눌렸으면 참.True if pressed this frame.

짝Counterpart: vanilla-engine InputManager.is_mouse_button_just_pressed

메서드methodisMouseButtonJustReleased(mouseButton)#0.4.0 부터since 0.4.0소스source

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

Whether the mouse button was released this frame.

mouseButtonnumber
MouseButton 의 값.A MouseButton value.

반환Returnsboolean 이번 프레임에 떼어졌으면 참.True if released this frame.

짝Counterpart: vanilla-engine InputManager.is_mouse_button_just_released

메서드methodsetTouchFromLeftButtonOnly(isLeftButtonOnly)#0.4.0 부터since 0.4.0소스source

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

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

Sets whether only the left mouse button is passed as touch. (When off (default), any button is touch as before)

  • If a game that uses right or middle drag for the camera turns it on, the UI is not pressed by those buttons.
isLeftButtonOnlyboolean
참이면 왼쪽 단추만 터치로 넘긴다.If true, only the left button is passed as touch.

짝Counterpart: vanilla-engine InputManager.set_touch_from_left_button_only

메서드methodisTouchFromLeftButtonOnly()#0.4.0 부터since 0.4.0소스source

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

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

반환Returnsboolean 왼쪽 단추만 터치로 넘기면 참.True if only the left button is passed as touch.

짝Counterpart: vanilla-engine InputManager.is_touch_from_left_button_only

메서드methodsetContextMenuPrevented(isPrevented)#0.4.0 부터since 0.4.0소스source

캔버스의 오른쪽 클릭 메뉴를 막을지 설정. (처음은 참, 지금까지와 같다)

Sets whether to block the canvas's right-click menu. (true initially, same as before)

isPreventedboolean
참이면 오른쪽 클릭 메뉴를 막는다.If true, the right-click menu is blocked.

짝Counterpart: vanilla-engine InputManager.set_context_menu_prevented

메서드methodisContextMenuPrevented()#0.4.0 부터since 0.4.0소스source

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

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

반환Returnsboolean 오른쪽 클릭 메뉴를 막으면 참.True if the right-click menu is blocked.

짝Counterpart: vanilla-engine InputManager.is_context_menu_prevented

메서드methodbeginTouchPoint(identifier, canvasNativePosition, viewPosition)#0.4.0 부터since 0.4.0소스source

손가락이 닿음. (엔진이 touchstart 의 바뀐 손가락마다 부른다, 이미 있는 번호면 움직임으로 본다)

A finger touched. (The engine calls it for each changed finger of touchstart, an existing number is treated as a move)

identifiernumber
손가락 번호. (Touch.identifier)Finger number. (Touch.identifier)
canvasNativePositionVector2
캔버스 왼쪽 위 기준 자리. (CSS 픽셀)Position from the canvas top-left. (CSS pixels)
viewPositionVector2
뷰 좌표의 자리.Position in view coordinates.

짝Counterpart: vanilla-engine InputManager.begin_touch_point

메서드methodmoveTouchPoint(identifier, canvasNativePosition, viewPosition)#0.4.0 부터since 0.4.0소스source

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

A finger moved. (A finger that touched this frame stays began)

identifiernumber
손가락 번호. (Touch.identifier)Finger number. (Touch.identifier)
canvasNativePositionVector2
캔버스 왼쪽 위 기준 자리. (CSS 픽셀)Position from the canvas top-left. (CSS pixels)
viewPositionVector2
뷰 좌표의 자리.Position in view coordinates.

짝Counterpart: vanilla-engine InputManager.move_touch_point

메서드methodendTouchPoint(identifier, canvasNativePosition, viewPosition, isCancelled)#0.4.0 부터since 0.4.0소스source

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

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

identifiernumber
손가락 번호. (Touch.identifier)Finger number. (Touch.identifier)
canvasNativePositionVector2
캔버스 왼쪽 위 기준 자리. (CSS 픽셀)Position from the canvas top-left. (CSS pixels)
viewPositionVector2
뷰 좌표의 자리.Position in view coordinates.
isCancelledboolean
참이면 취소, 거짓이면 뗌.Cancelled if true, lifted if false.

짝Counterpart: vanilla-engine InputManager.end_touch_point

메서드methodfindTouchPoint(identifier)#0.4.0 부터since 0.4.0소스source

손가락 찾기. (없으면 null)

Finds a finger. (null if none)

identifiernumber
손가락 번호. (Touch.identifier)Finger number. (Touch.identifier)

반환ReturnsTouchPoint | null 찾은 손가락. (없으면 null)The found finger. (null if none)

짝Counterpart: vanilla-engine InputManager.find_touch_point

메서드methodgetTouchPoints()#0.4.0 부터since 0.4.0소스source

닿아 있는 손가락 목록. (닿은 차례, 단계는 began, moved, stationary, 받은 배열을 바꾸지 않는다)

List of touching fingers. (In touch order, phases are began, moved, stationary, do not modify the received array)

반환ReturnsTouchPoint[] 닿아 있는 손가락 목록. (안의 배열 그대로)List of touching fingers. (the internal array as is)

짝Counterpart: vanilla-engine InputManager.get_touch_points

메서드methodgetEndedTouchPoints()#0.4.0 부터since 0.4.0소스source

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

List of fingers lifted this frame. (Phases are ended, cancelled, position is where it was lifted)

반환ReturnsTouchPoint[] 이번 프레임에 떨어진 손가락 목록.List of fingers lifted this frame.

짝Counterpart: vanilla-engine InputManager.get_ended_touch_points

메서드methodsetLastInputDevice(inputDevice)#0.4.0 부터since 0.4.0소스source

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

Sets the last used input device. (The engine calls it on key, mouse, finger and pad input, also when a game uses an external input source)

inputDevicestring
InputDevice 의 값.An InputDevice value.

짝Counterpart: vanilla-engine InputManager.set_last_input_device

메서드methodgetLastInputDevice()#0.4.0 부터since 0.4.0소스source

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

Returns the last used input device. (Initially touch on finger devices, otherwise keyboard)

반환Returnsstring InputDevice 의 값.An InputDevice value.

짝Counterpart: vanilla-engine InputManager.get_last_input_device

메서드methodisTouchInput()#0.4.0 부터since 0.4.0소스source

마지막 입력이 손가락인지. (마우스, 키보드, 게임패드면 거짓)

Whether the last input was a finger. (false for mouse, keyboard, gamepad)

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

짝Counterpart: vanilla-engine InputManager.is_touch_input

메서드methodsetLastGamepadKind(gamepadKind)#0.4.0 부터since 0.4.0소스source

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

Sets the kind of the last used gamepad.

gamepadKindstring
GamepadKind 의 값.A GamepadKind value.

짝Counterpart: vanilla-engine InputManager.set_last_gamepad_kind

메서드methodgetLastGamepadKind()#0.4.0 부터since 0.4.0소스source

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

Returns the kind of the last used gamepad. (Determined by the name of the pad that pressed a button or tilted a stick far, initially other)

반환Returnsstring GamepadKind 의 값.A GamepadKind value.

짝Counterpart: vanilla-engine InputManager.get_last_gamepad_kind

메서드methodsetPreventedKeys(keys)#0.4.0 부터since 0.4.0소스source

브라우저 기본 동작을 막을 키 설정. (KeyboardEvent.code 목록, Tab 의 초점 옮기기, Space 의 쪽 넘기기 같은 것)

  • 글자 입력칸에 초점이 있으면 막지 않는다. (isTypingInTextField)

Sets the keys whose browser default behavior is blocked. (KeyboardEvent.code list, such as Tab's focus move or Space's page scroll)

  • Not blocked while a text input field has focus. (isTypingInTextField)
keysstring[]
막을 키 코드 목록. (KeyboardEvent.code)List of key codes to block. (KeyboardEvent.code)

짝Counterpart: vanilla-engine InputManager.set_prevented_keys

메서드methodgetPreventedKeys()#0.4.0 부터since 0.4.0소스source

브라우저 기본 동작을 막을 키 목록 반환. (사본)

Returns the list of keys whose browser default behavior is blocked. (copy)

반환Returnsstring[] 막는 키 코드 목록의 사본.A copy of the blocked key code list.

짝Counterpart: vanilla-engine InputManager.get_prevented_keys

메서드methodisKeyPrevented(key)#0.4.0 부터since 0.4.0소스source

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

Whether the key's default behavior is blocked.

keystring
키 코드. (KeyboardEvent.code, 예: "KeyW", "Space")Key code. (KeyboardEvent.code, e.g. "KeyW", "Space")

반환Returnsboolean 기본 동작을 막으면 참.True if the default action is blocked.

짝Counterpart: vanilla-engine InputManager.is_key_prevented

메서드methodisTypingInTextField()#0.4.0 부터since 0.4.0소스source

글자 입력칸에 쓰는 중인지. (초점이 글자 input, textarea, contenteditable, select 에 있음)

Whether typing in a text input field. (Focus is on a text input, textarea, contenteditable, select)

반환Returnsboolean 글자 입력칸에 쓰는 중이면 참.True if typing in a text input.

짝Counterpart: vanilla-engine InputManager.is_typing_in_text_field

메서드methodgetInputActions()#0.4.0 부터since 0.4.0소스source

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

Returns the input actions. (Reads keys, pad buttons and axes bound to action names, updated every tick)

반환ReturnsInputActions 입력 동작.Input actions.

짝Counterpart: vanilla-engine InputManager.get_input_actions

KeyCodeenum

짝Counterpart: vanilla-engine KeyCode

키보드 키 식별자. (KeyboardEvent.code 의 값)

Keyboard key identifiers. (the KeyboardEvent.code values)

이름Name값Value설명Description
aKeyAA 키.Key A.
bKeyBB 키.Key B.
cKeyCC 키.Key C.
dKeyDD 키.Key D.
eKeyEE 키.Key E.
fKeyFF 키.Key F.
gKeyGG 키.Key G.
hKeyHH 키.Key H.
iKeyII 키.Key I.
jKeyJJ 키.Key J.
kKeyKK 키.Key K.
lKeyLL 키.Key L.
mKeyMM 키.Key M.
nKeyNN 키.Key N.
oKeyOO 키.Key O.
pKeyPP 키.Key P.
qKeyQQ 키.Key Q.
rKeyRR 키.Key R.
sKeySS 키.Key S.
tKeyTT 키.Key T.
uKeyUU 키.Key U.
vKeyVV 키.Key V.
wKeyWW 키.Key W.
xKeyXX 키.Key X.
yKeyYY 키.Key Y.
zKeyZZ 키.Key Z.
0Digit0숫자 0 키. (글쇠 윗줄)Digit 0 key. (top row)
1Digit1숫자 1 키. (글쇠 윗줄)Digit 1 key. (top row)
2Digit2숫자 2 키. (글쇠 윗줄)Digit 2 key. (top row)
3Digit3숫자 3 키. (글쇠 윗줄)Digit 3 key. (top row)
4Digit4숫자 4 키. (글쇠 윗줄)Digit 4 key. (top row)
5Digit5숫자 5 키. (글쇠 윗줄)Digit 5 key. (top row)
6Digit6숫자 6 키. (글쇠 윗줄)Digit 6 key. (top row)
7Digit7숫자 7 키. (글쇠 윗줄)Digit 7 key. (top row)
8Digit8숫자 8 키. (글쇠 윗줄)Digit 8 key. (top row)
9Digit9숫자 9 키. (글쇠 윗줄)Digit 9 key. (top row)
backspaceBackspace백스페이스 키.Backspace key.
tabTab탭 키.Tab key.
enterEnter엔터 키.Enter key.
shiftShiftLeft왼쪽 시프트 키.Left Shift key.
ctrlControlLeft왼쪽 컨트롤 키.Left Control key.
altAltLeft왼쪽 알트 키.Left Alt key.
capslockCapsLock캡스락 키.Caps Lock key.
escapeEscape이스케이프 키.Escape key.
spaceSpace스페이스 키.Space key.
pageupPageUp페이지 업 키.Page Up key.
pagedownPageDown페이지 다운 키.Page Down key.
endEnd엔드 키.End key.
homeHome홈 키.Home key.
arrowleftArrowLeft왼쪽 화살표 키.Left arrow key.
arrowupArrowUp위쪽 화살표 키.Up arrow key.
arrowrightArrowRight오른쪽 화살표 키.Right arrow key.
arrowdownArrowDown아래쪽 화살표 키.Down arrow key.
insertInsert인서트 키.Insert key.
deleteDelete딜리트 키.Delete key.
f1F1F1 키.F1 key.
f2F2F2 키.F2 key.
f3F3F3 키.F3 key.
f4F4F4 키.F4 key.
f5F5F5 키.F5 key.
f6F6F6 키.F6 key.
f7F7F7 키.F7 key.
f8F8F8 키.F8 key.
f9F9F9 키.F9 key.
f10F10F10 키.F10 key.
f11F11F11 키.F11 key.
f12F12F12 키.F12 key.
scrolllockScrollLock스크롤 락 키.Scroll Lock key.
semicolonSemicolon세미콜론 키.Semicolon key.
equalEqual등호 키.Equal key.
commaComma쉼표 키.Comma key.
minusMinus빼기 키.Minus key.
periodPeriod마침표 키.Period key.
slashSlash슬래시 키.Slash key.
backquoteBackquote백쿼트 키.Backquote key.
bracketleftBracketLeft왼쪽 대괄호 키.Left bracket key.
backslashBackslash역슬래시 키.Backslash key.
bracketrightBracketRight오른쪽 대괄호 키.Right bracket key.
quoteQuote따옴표 키.Quote key.
metaMetaLeft왼쪽 메타 키. (윈도우 키, 맥의 커맨드 키)Left Meta key. (Windows key, Command key on Mac)
commandMetaLeft왼쪽 커맨드 키. (meta 와 같은 값)Left Command key. (same value as meta)
pausePause포즈 키.Pause key.
audiovolumeupAudioVolumeUp소리 키움 키.Volume up key.
audiovolumedownAudioVolumeDown소리 줄임 키.Volume down key.
audiomuteAudioVolumeMute음소거. (W3C code 표의 이름)Mute. (name from the W3C code table)
audioplayMediaPlayPause재생/멈춤. (W3C code 표의 이름, 표에 MediaPlay 는 없다)Play/pause. (name from the W3C code table, the table has no MediaPlay)
audiostopMediaStop미디어 정지 키.Media stop key.
audioprevMediaTrackPrevious이전 곡 키.Previous track key.
audionextMediaTrackNext다음 곡 키.Next track key.
numLockNumLock텐키 넘 락 키.Num Lock key.
numpadDivideNumpadDivide텐키 나누기.Numpad divide.
numpadMultiplyNumpadMultiply텐키 곱하기.Numpad multiply.
numpadSubtractNumpadSubtract텐키 빼기.Numpad subtract.
numpadDecimalNumpadDecimal텐키 점.Numpad decimal point.
numpadAddNumpadAdd텐키 더하기.Numpad add.
numpadEnterNumpadEnter텐키 엔터.Numpad enter.
numpad0Numpad0텐키 0.Numpad 0.
numpad1Numpad1텐키 1.Numpad 1.
numpad2Numpad2텐키 2.Numpad 2.
numpad3Numpad3텐키 3.Numpad 3.
numpad4Numpad4텐키 4.Numpad 4.
numpad5Numpad5텐키 5.Numpad 5.
numpad6Numpad6텐키 6.Numpad 6.
numpad7Numpad7텐키 7.Numpad 7.
numpad8Numpad8텐키 8.Numpad 8.
numpad9Numpad9텐키 9.Numpad 9.

MouseButtonenum

짝Counterpart: vanilla-engine MouseButton

마우스 단추. (MouseEvent.button 의 값)

Mouse button. (MouseEvent.button value)

이름Name값Value설명Description
left0왼쪽 단추.Left button.
middle1가운데 단추. (휠 누름)Middle button. (wheel press)
right2오른쪽 단추.Right button.

TouchPhaseenum

짝Counterpart: vanilla-engine TouchPhase

손가락의 단계. (began 이번 프레임에 닿음, moved 움직임, stationary 가만히, ended 뗌, cancelled 취소)

Finger phase. (began touched this frame, moved moving, stationary still, ended lifted, cancelled cancelled)

이름Name값Value설명Description
beganbegan이번 프레임에 닿음.Touched this frame.
movedmoved움직임.Moved.
stationarystationary가만히 있음.Stationary.
endedended뗌.Lifted.
cancelledcancelled취소됨. (브라우저가 터치를 거둠)Cancelled. (the browser withdrew the touch)

InputDeviceenum

짝Counterpart: vanilla-engine InputDevice

마지막으로 쓴 입력 장치.

Last used input device.

이름Name값Value설명Description
keyboardkeyboard키보드.Keyboard.
mousemouse마우스.Mouse.
touchtouch손가락.Finger.
gamepadgamepad게임패드.Gamepad.