PokéRogue
    Preparing search index...

    Interface ComputedSize

    Provides methods used for calculating and setting the size of a non-Frame based Game Object. A non-Frame based Game Object is one that derives its dimensions from internal logic rather than from a texture frame, such as Graphics, Text, or BitmapText objects.

    The component exposes width and height as the native (un-scaled) dimensions, and displayWidth and displayHeight as the rendered dimensions after the scale factor is applied.

    Should be applied as a mixin and not used directly.

    interface ComputedSize {
        displayHeight: number;
        displayWidth: number;
        height: number;
        width: number;
        setDisplaySize(width: number, height: number): this;
        setSize(width: number, height: number): this;
    }

    Implemented by

    Index
    displayHeight: number

    The displayed height of this Game Object.

    This value takes into account the scale factor.

    Setting this value will adjust the Game Object's scale property.

    displayWidth: number

    The displayed width of this Game Object.

    This value takes into account the scale factor.

    Setting this value will adjust the Game Object's scale property.

    height: number

    The native (un-scaled) height of this Game Object.

    Changing this value will not change the size that the Game Object is rendered in-game. For that you need to either set the scale of the Game Object (setScale) or use the displayHeight property.

    width: number

    The native (un-scaled) width of this Game Object.

    Changing this value will not change the size that the Game Object is rendered in-game. For that you need to either set the scale of the Game Object (setScale) or use the displayWidth property.

    • Sets the display size of this Game Object.

      Calling this will adjust the scaleX and scaleY properties so that the Game Object is rendered at the specified pixel dimensions. It is the equivalent of setting the scale manually, but expressed in pixels rather than as a multiplier.

      Parameters

      • width: number

        The width of this Game Object.

      • height: number

        The height of this Game Object.

      Returns this

      This Game Object instance.

    • Sets the internal size of this Game Object, as used for frame or physics body creation.

      This will not change the size that the Game Object is rendered in-game. For that you need to either set the scale of the Game Object (setScale) or call the setDisplaySize method, which is the same thing as changing the scale but allows you to do so by giving pixel values.

      If you have enabled this Game Object for input, changing the size will not change the size of the hit area. To do this you should adjust the input.hitArea object directly.

      Parameters

      • width: number

        The width of this Game Object.

      • height: number

        The height of this Game Object.

      Returns this

      This Game Object instance.