//
// Flambe - Rapid game development
// https://github.com/aduros/flambe/blob/master/LICENSE.txt

package flambe.platform.html;

import flambe.platform.Stage;
import flambe.util.Signal0;

class HtmlStage
    implements Stage
{
    public var width (getWidth, null) :Int;
    public var height (getHeight, null) :Int;

    public var resize (default, null) :Signal0;

    public function new (canvas :Dynamic)
    {
        _canvas = canvas;
        _canvas.addEventListener("resize", function (_) {
            resize.emit();
        }, false);
    }

    public function getWidth () :Int
    {
        return _canvas.width;
    }

    public function getHeight () :Int
    {
        return _canvas.height;
    }

    public function lockOrientation (orient :Orientation)
    {
        // Nothing until mobile browsers support it
    }

    private var _canvas :Dynamic;
}

//
// Flambe - Rapid game development
// https://github.com/aduros/flambe/blob/master/LICENSE.txt

package flambe.platform.html;

import js.Lib;

import flambe.platform.Stage;
import flambe.util.Signal0;

class HtmlStage
    implements Stage
{
    public var width (getWidth, null) :Int;
    public var height (getHeight, null) :Int;

    public var resize (default, null) :Signal0;

    public function new (canvas :Dynamic)
    {
        _canvas = canvas;
        resize = new Signal0();

        (untyped Lib.window).addEventListener("resize", function (event) {
            resize.emit();
        }, false);
    }

    public function getWidth () :Int
    {
        return _canvas.width;
    }

    public function getHeight () :Int
    {
        return _canvas.height;
    }

    public function lockOrientation (orient :Orientation)
    {
        // Nothing until mobile browsers support it
    }

    private var _canvas :Dynamic;
}

Fix resize events in html.
Fix resize events in html.

aduros/flambe,markknol/flambe,Disar/flambe,aduros/flambe,aduros/flambe,mikedotalmond/flambe,markknol/flambe,playedonline/flambe,weilitao/flambe,weilitao/flambe,mikedotalmond/flambe,playedonline/flambe,playedonline/flambe,playedonline/flambe,Disar/flambe,markknol/flambe,aduros/flambe,mikedotalmond/flambe,weilitao/flambe,Disar/flambe,weilitao/flambe,mikedotalmond/flambe,Disar/flambe