phaser - v4.0.0-rc.4
    Preparing search index...

    Provides methods used for getting and setting the size of a Game Object.

    interface Size {
        displayHeight: number;
        displayWidth: number;
        height: number;
        width: number;
        setDisplaySize(width: number, height: number): this;
        setSize(width: number, height: number): this;
        setSizeToFrame(frame?: boolean | Frame): this;
    }

    Implemented by

    Index

    Properties

    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.

    Methods

    • Sets the display size of this Game Object.

      Calling this will adjust the scale.

      Parameters

      • width: number

        The width of this Game Object.

      • height: number

        The height of this Game Object.

      Returns this

    • 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

    • Sets the size of this Game Object to be that of the given Frame.

      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

      • Optionalframe: boolean | Frame

        The frame to base the size of this Game Object on.

      Returns this