UNPKG

blaze-2d

Version:

A fast and simple WebGL 2 2D game engine written in TypeScript

30 lines (29 loc) 872 B
import Camera from "../camera/camera"; import Object2D from "../object2d"; /** * Stores common properties and methods for controls. */ export default abstract class Controls { element: HTMLElement; sensitivity: number; movementX: number; movementY: number; object: Object2D; camera: Camera; /** * Creates a {@link Controls} instance. * * @param element The element to use when handling control events * @param object An optional object to follow the camera's yaw * @param sensitivity Movement sensitivity */ constructor(element: HTMLElement, camera: Camera, object?: Object2D, sensitivity?: number); /** * Called every tick. */ abstract update(): void; /** * Removes all events used for the controls and deals with any extra cleanup needed. */ abstract dispose(): void; }