API Docs for:
Show:

Style Class

Module: ui

A UI style can applied to a UI object to modify it properties like color, image, etc. to give a certain "style" to it.

Methods

apply

(
  • object
)

Applies the style to a UI object.

Parameters:

  • object ui.Object_UIElement
    • The UI object where the style should be applied to.

applyAnimations

(
  • object
)
protected

Applies the animation-data of the style to a UI object. This automatically adds an animation-handler component(ui.Component_AnimationHandler) with the id "animationHandler" to the UI object if not already exists.

Parameters:

  • object ui.Object_UIElement
    • The UI object where the animation-data should be applied to.

applyLooping

(
  • object
)
protected

Applies the looping-data of the style to a UI object.

Parameters:

  • object ui.Object_UIElement
    • The UI object where the looping-data should be applied to.

revert

(
  • object
)

Reverts the changes from a UI object made by this style. However, this resets all styleable properties were set by this style. So it is necessary to apply all other styles again, but that is already handles in ui.Component_UIBehavior.

Parameters:

  • object ui.Object_UIElement
    • The UI object where the style should be reverted.

revertAnimations

(
  • object
)

Reverts the animation-data changes applied to a UI object by this style.

Parameters:

  • object ui.Object_UIElement
    • The UI object where the animation-data changes should be reverted.

revertLooping

(
  • object
)

Reverts the looping-data changes applied to a UI object by this style.

Parameters:

  • object ui.Object_UIElement
    • The UI object where the looping-data changes should be reverted.

setFromDescriptor

(
  • descriptor
)

Initializes the style from a style-descriptor.

Parameters:

  • descriptor Object
    • The style-descriptor.

setupFont

(
  • descriptor
)
protected

Initializes font-data from a style-descriptor.

Parameters:

  • descriptor Object
    • The style-descriptor.

Properties

alignment

ui.Alignment

The UI object's alignment.

alignmentX

Number

The object's alignment on x-axis. Needs to be supported by layout.

alignmentY

Number

The object's alignment on y-axis. Needs to be supported by layout.

anchor

gs.Point

The UI object's anchor-point. For example: An anchor-point with 0,0 places the object with its top-left corner at its position but with an 0.5, 0.5 anchor-point the object is placed with its center. An anchor-point of 1,1 places the object with its lower-right corner.

animations

Object

The UI object's animations used for visual presentation.

Default: null

clipRect

gs.Rect protected

The object's clip-rect for visual presentation.

Default: null

color

gs.Color

The UI object's color.

descriptor

Object

The original style descriptor.

font

gs.Font

The font used for the text-display.

Default: null

frameCornerSize

Number

The corner-size of the frame.

frameThickness

Number

The thickness of the frame.

id

Number

ID number to quickly access this style and link to this style.

image

String

The UI object's image used for visual presentation.

looping

ui.Orientation

The looping of the image.

margin

Object

The UI object's margin. The margin defines an extra space around the UI object. The default is { left: 0, top: 0, right: 0, bottom: 0 }.

mask

gs.Mask

The UI object's mask for masking-effects.

opacity

Number

The UI object's opacity to control transparency. For example: 0 = Transparent, 255 = Opaque, 128 = Semi-Transparent.

padding

Object

The UI object's padding. The default is { left: 0, top: 0, right: 0, bottom: 0 }.

resizable

Boolean

The object's resize behavior.

selector

Number

Selector-ID which controls under which conditions the style becomes active.

target

Number

Style-ID of target object. This style will only be applied on UI objects with that style ID which are children of UI objects where this style is applied.

zIndex

Number

The object's z-index controls rendering-order/image-overlapping. An object with a smaller z-index is rendered before an object with a larger index. For example: To make sure a game object is always on top of the screen, it should have the largest z-index of all game objects.

zoom

gs.Point

The UI object's zoom-setting for x and y axis.

Default: new gs.Point(1.0, 1.0)