API Reference

Class List

pc.ScreenComponent

Extends: pc.Component

A ScreenComponent enables the Entity to render child pc.ElementComponents using anchors and positions in the ScreenComponent's space.

Summary

Properties

cullIf true then elements inside this screen will be not be rendered when outside of the screen (only valid when screenSpace is true)
referenceResolutionThe resolution that the ScreenComponent is designed for.
resolutionThe width and height of the ScreenComponent.
scaleBlendA value between 0 and 1 that is used when scaleMode is equal to pc.SCALEMODE_BLEND.
scaleModeCan either be pc.SCALEMODE_NONE or pc.SCALEMODE_BLEND.
screenSpaceIf true then the ScreenComponent will render its child pc.ElementComponents in screen space instead of world space.

Methods

syncDrawOrderSet the drawOrder of each child pc.ElementComponent so that ElementComponents which are last in the hierarchy are rendered on top.

Inherited

Properties

enabledEnables or disables the component.

Details

Constructor

ScreenComponent(system, entity)

Create a new ScreenComponent

Parameters

systempc.ScreenComponentSystemThe ComponentSystem that created this Component
entitypc.EntityThe Entity that this Component is attached to.

Properties

Booleancull

If true then elements inside this screen will be not be rendered when outside of the screen (only valid when screenSpace is true)

pc.Vec2referenceResolution

The resolution that the ScreenComponent is designed for. This is only taken into account when screenSpace is true and scaleMode is pc.SCALEMODE_BLEND. If the actual resolution is different then the ScreenComponent will be scaled according to the scaleBlend value.

pc.Vec2resolution

The width and height of the ScreenComponent. When screenSpace is true the resolution will always be equal to pc.GraphicsDevice#width x pc.GraphicsDevice#height.

NumberscaleBlend

A value between 0 and 1 that is used when scaleMode is equal to pc.SCALEMODE_BLEND. Scales the ScreenComponent with width as a reference (when value is 0), the height as a reference (when value is 1) or anything in between.

StringscaleMode

Can either be pc.SCALEMODE_NONE or pc.SCALEMODE_BLEND. See the description of referenceResolution for more information.

BooleanscreenSpace

If true then the ScreenComponent will render its child pc.ElementComponents in screen space instead of world space. Enable this to create 2D user interfaces.

Methods

syncDrawOrder()

Set the drawOrder of each child pc.ElementComponent so that ElementComponents which are last in the hierarchy are rendered on top. Draw Order sync is queued and will be updated by the next update loop.

Inherited

Properties

Booleanenabled

Enables or disables the component.