Examples
import { World } from '@wimaengine/ecs'
import { createCamera2D } from '@wimaengine/render-core'
const world = new World()
const cameraEntity = world.spawn(createCamera2D(2, 3, Math.PI / 4, 1, 1))Function
createCamera2D(x?: number, y?: number, a?: number, sx?: number, sy?: number): [Position2D, Orientation2D, Scale2D, GlobalTransform2D, Camera, RenderLists2D]Creates the ordered component tuple for a 2D camera entity.
The returned tuple contains Position2D, Orientation2D,
Scale2D, GlobalTransform2D, Camera, and
RenderLists2D, in that order. The transform components are created
by createTransform2D from the position, angle, and scale
arguments. The camera uses a new OrthographicProjection with its
default bounds (left = -1, right = 1, top = 1, and bottom = -1), and
the render-list component starts empty.
Pass the returned tuple directly to World#spawn; the world adds the
entity handle while storing the components.
import { World } from '@wimaengine/ecs'
import { createCamera2D } from '@wimaengine/render-core'
const world = new World()
const cameraEntity = world.spawn(createCamera2D(2, 3, Math.PI / 4, 1, 1))