Class: ScreenComponent

pc.ScreenComponent

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

Constructor

new ScreenComponent(system, entity)

Create a new ScreenComponent
Parameters:
Name Type Description
system pc.ScreenComponentSystem The ComponentSystem that created this Component
entity pc.Entity The Entity that this Component is attached to.
Properties:
Name Type Description
screenSpace Boolean 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.
cull Boolean If true then elements inside this screen will be not be rendered when outside of the screen (only valid when screenSpace is true)
scaleMode String Can either be pc.SCALEMODE_NONE or pc.SCALEMODE_BLEND. See the description of referenceResolution for more information.
scaleBlend Number 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.
resolution pc.Vec2 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.
referenceResolution pc.Vec2 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.
Source:

Extends

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.
Source: