Skip to content

Add zoom function to FP.screen #113

@mbroersen

Description

@mbroersen

I'd like to add this to the screen class:

    /**
     * Zoom full screen.
     */
    public function zoom(scale:Number):void 
    {
        this.scale = scale;

        var width:int = FP.width / this.scale;
        var height:int = FP.height / this.scale; 

        FP.bounds.width = width;
        FP.bounds.height = height;

        this.resize(width, height);
    }


    /**
     * Initialise buffers to current screen size.
     */
    public function resize(width:int = 0, height:int = 0):void
    {
        if (width <= 0) {
            width = FP.width
        }

        if (height <= 0) {
            height = FP.width
        }

I tested the code a little bit, don't know if it causes any trouble in other bits of the code. but my test ran fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions