UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

105 lines 4.18 kB
import DisplayObjectContainer from "./DisplayObjectContainer"; import DisplayObject from "./DisplayObject"; import Starling from "../core/Starling"; import Vector3D from "openfl/geom/Vector3D"; import Rectangle from "openfl/geom/Rectangle"; import Point from "openfl/geom/Point"; declare namespace starling.display { /** * Dispatched when the Flash container is resized. */ export class Stage extends DisplayObjectContainer { /** * @private */ protected constructor(width: number, height: number, color?: number); /** * @inheritDoc */ advanceTime(passedTime: number): void; /** * Returns the object that is found topmost beneath a point in stage coordinates, or * * the stage itself if nothing else is found. */ override hitTest(localPoint: Point): DisplayObject; /** * Returns the stage bounds (i.e. not the bounds of its contents, but the rectangle * * spawned up by 'stageWidth' and 'stageHeight') in another coordinate system. */ getStageBounds(targetSpace: DisplayObject, out?: Rectangle): Rectangle; /** * Returns the bounds of the screen (or application window, on Desktop) relative to * * a certain coordinate system. In most cases, that's identical to the stage bounds; * * however, this changes if the viewPort is customized. */ getScreenBounds(targetSpace: DisplayObject, out?: Rectangle): Rectangle; /** * Returns the position of the camera within the local coordinate system of a certain * * display object. If you do not pass a space, the method returns the global position. * * To change the position of the camera, you can modify the properties 'fieldOfView', * * 'focalDistance' and 'projectionOffset'. * */ getCameraPosition(space?: DisplayObject, out?: Vector3D): Vector3D; /** * The background color of the stage. */ get color(): number; set color(value: number) /** * The width of the stage coordinate system. Change it to scale its contents relative * * to the <code>viewPort</code> property of the Starling object. */ get stageWidth(): number; set stageWidth(value: number) /** * The height of the stage coordinate system. Change it to scale its contents relative * * to the <code>viewPort</code> property of the Starling object. */ get stageHeight(): number; set stageHeight(value: number) /** * The Starling instance this stage belongs to. */ get starling(): Starling; /** * The distance between the stage and the camera. Changing this value will update the * * field of view accordingly. */ get focalLength(): number; set focalLength(value: number) /** * Specifies an angle (radian, between zero and PI) for the field of view. This value * * determines how strong the perspective transformation and distortion apply to a Sprite3D * * object. * * * * <p>A value close to zero will look similar to an orthographic projection; a value * * close to PI results in a fisheye lens effect. If the field of view is set to 0 or PI, * * nothing is seen on the screen.</p> * * * * @default 1.0 * */ get fieldOfView(): number; set fieldOfView(value: number) /** * A vector that moves the camera away from its default position in the center of the * * stage. Use this property to change the center of projection, i.e. the vanishing * * point for 3D display objects. <p>CAUTION: not a copy, but the actual object!</p> * */ get projectionOffset(): Point; set projectionOffset(value: Point) /** * The global position of the camera. This property can only be used to find out the * * current position, but not to modify it. For that, use the 'projectionOffset', * * 'fieldOfView' and 'focalLength' properties. If you need the camera position in * * a certain coordinate space, use 'getCameraPosition' instead. * * * * <p>CAUTION: not a copy, but the actual object!</p> * */ get cameraPosition(): Vector3D; } } export default starling.display.Stage;