import { Transform2D } from '../../component/2d'; import { Entity } from '../../entity'; import { Mat3, Vec2 } from '../../math'; import { Camera } from '../camera'; import { Camera2DConfig, Camera2DFollow, Camera2DFollowRules } from './camera.2d.config'; /** * Concrete Camera2D, representing a 2D Camera and narrowing generic types to their corresponding 2D variants */ export declare class Camera2D extends Camera { /** Concrete Mat3 projection matrix */ projection: Mat3; /** Concrete 2D 'Follow' specification */ protected following: Camera2DFollow | undefined; /** Concrete 2D Transform */ protected transform: Transform2D; /** * Constructor. Take the type-correct Camera2DConfig and pass it up to the parent class * * Initialise the projection matrix and Transform2D * * @param config the Camera2DConfig */ constructor(config: Camera2DConfig); /** * Concrete Camera Follow configuration routine, narrowing the generic rules type to Camera2DFollowRules for consumer safety * * Set out the default follow rules: * - position.x - true * - position.y - true * - angle - false * * @param entity the Entity to follow * @param rules the Camera2DFollowRules, specifying how the Camera should follow the Entity */ attachTo(entity: Entity, rules?: Camera2DFollowRules): void; /** * Concrete View Matrix computation routine, narrowing the generic return type to Mat3 * * @returns the View Matrix */ getViewMatrix(): Mat3; /** * Abstraction for (Transform2D).moveRight() - move the Camera along its right axis by an amount * * @param amount the amount to move */ moveRight(amount: number): void; /** * Abstraction for (Transform2D).moveUp() - move the Camera along its up axis by an amount * * @param amount the amount to move */ moveUp(amount: number): void; /** * Abstraction for (Transform2D).translate() - move the Camera according to the world axes by a translation vector * * @param amount the translation vector */ translate(translate: Vec2): void; /** * Abstraction for (Transform2D).rotate() - rotate the Camera by an angle (radians) * * @param angle the angle (radians) to rotate by */ rotate(angle: number): void; /** * Abstraction for (Transform2D).scaleBy() - 'zoom' the Camera by scaling by a factor relative to its current scale * * @param factor the factor to scale by */ zoom(factor: Vec2): void; /** * Abstraction for (Transform2D).scaleTo() - 'zoom' the Camera by scaling to an absolute factor * * @param factor the factor to scale to */ zoomTo(factor: Vec2): void; /** * Internal-use convenience method for calculating the Camera2D's actual position, accounting for the position of the followed Entity, * if applicable * * @returns the actual position of the Camera2D */ private actualPosition; /** * Internal-use convenience method for calculating the Camera2D's actual rotation, accounting for the rotation of the followed Entity, * if applicable * * @returns the actual rotation of the Camera2D */ private actualAngle; }