TM.InputManager

View source code: https://github.com/a-mean-blogger/text-game-maker-js/blob/master/src/managers/input-manager/input-manager.js

Type

Class (extends TM.IObject)

Purpose

A class that creates instances manage other instances get user inputs. There is Currently only one sub instance for keyboard input(TM.InputManager_keyboard's instance).

Text Game Maker JS v1.0.0 only supports keyboard input, it does not supports mouse nor touch inputs. They can be added later version.

Constructor Parameters

new TM.InputManager(customTargetDomId,devMode)
  • customTargetDomId(optional): HTML DOM ID the inputs are captured on. (default: TM.defaultSettings.screen.canvasId)
  • devMode(optional)true for debugging, false for production. (default: false). If it's true, it prints input information on the browser console for debugging.

Important Properties

  • isActive: It will be set true after calling init function, false after calling inactivate. The Object status(active/inactive) can be checked by this property.
  • keyboard: As an instance of TM.InputManager_Keyboard, it captures keyboard inputs.

Important Functions

  • init(): activates/initializes the instance. (It executes when the instance created)
  • inactivate(): inactivates the instance. User inputs will not be captured.

Example

  • Keyboard input example: Please see this on TM.InputManager_Keyboard

Comments

Add Comment

Login with SNS account to write comments. see details

UP