API Documentation for: 0.0.1
Show:

UIScaler Class

Defined in: UIScaler:10
Namespace: cloudkid

The UI scale is responsible for scaling UI components to help easy the burden of different device aspect ratios

Item Index

Properties

Methods

add

(
  • item
  • [vertAlign="center"]
  • [horiAlign="center"]
  • [titleSafe=false]
  • [minScale=1]
  • [maxScale=1]
  • [centeredHorizontally=false]
)

Defined in add:208

Manually add an item

Parameters:

  • item PIXI.DisplayObject

    The display object item to add

  • [vertAlign="center"] String optional

    The vertical align of the item (cefault is center)

  • [horiAlign="center"] String optional

    The horizontal align of the item (default is center)

  • [titleSafe=false] Boolean optional

    If the item needs to be in the title safe area (default is false)

  • [minScale=1] Number optional

    The minimum scale amount (default, scales the same size as the stage)

  • [maxScale=1] Number optional

    The maximum scale amount (default, scales the same size as the stage)

  • [centeredHorizontally=false] Boolean optional

    Makes sure that the center of the object was at the center of the screen, assuming an origin at the top left of the object

destroy

()

Defined in destroy:300

Destroy the scaler object

fromJSON

(
  • parent
  • jsonSettings
  • jsonItems
  • [immediateDestroy=true]
)
UIScaler static

Defined in fromJSON:119

Create the scaler from JSON data

Parameters:

  • parent PIXI.DisplayObject

    The UI display container

  • jsonSettings Object

    The json of the designed settings {designedWidth:800, designedHeight:600, designedPPI:72}

  • jsonItems Object

    The json items object where the keys are the name of the property on the parent and the value is an object with keys of "titleSafe", "minScale", "maxScale", "centerHorizontally", "align"

  • [immediateDestroy=true] Boolean optional

    If we should immediately cleanup the UIScaler after scaling items

Returns:

UIScaler:

The scaler object that can be reused

getScale

() Number

Defined in getScale:198

Get the current scale of the screen

Returns:

Number:

The current stage scale

init

(
  • screenWidth
  • screenHeight
  • screenPPI
)
static

Defined in init:182

Set the current screen settings. If the stage size changes at all, re-call this function

Parameters:

  • screenWidth Number

    The fullscreen width

  • screenHeight Number

    The fullscreen height

  • screenPPI Number

    The screen resolution density

resize

()

Defined in resize:285

Scale the UI items that have been registered to the current screen

resizeBackground

(
  • The
)
static

Scale a single background image according to the UIScaler.width and height

Parameters:

  • The PIXI.Bitmap

    bitmap to scale

resizeBackgrounds

(
  • bitmaps
)
static

Convenience function to scale a collection of backgrounds

Parameters:

  • bitmaps Array

    The collection of bitmap images

Properties

_designedScreen

ScreenSettings private

Defined in _designedScreen:55

The screen settings object, contains information about designed size

_items

Array private

Defined in _items:62

The configuration for each items

_parent

PIXI.DisplayObject private

Defined in _parent:48

The UI display object to update

ALIGN_BOTTOM

String final static

Defined in ALIGN_BOTTOM:79

Vertically align to the bottom

Default: "bottom"

ALIGN_CENTER

String final static

Defined in ALIGN_CENTER:109

Vertically or horizontally align to the center

Default: "center"

ALIGN_LEFT

String final static

Defined in ALIGN_LEFT:89

Horizontally align to the left

Default: "left"

ALIGN_RIGHT

String final static

Defined in ALIGN_RIGHT:99

Horizontally align to the right

Default: "right"

ALIGN_TOP

String final static

Defined in ALIGN_TOP:69

Vertically align to the top

Default: "top"

currentScreen

ScreenSettings private static

Defined in currentScreen:32

The current screen settings

initialized

Boolean private static

Defined in initialized:40

If the screensize has been set