YAL-Haxe / openfl-bitfive

Alternative blitting-targeted HTML5 backend for OpenFL.
103 stars 19 forks source link

openfl-bitfive ignoring width and height attributes in Project.xml #28

Closed cjke closed 10 years ago

cjke commented 10 years ago

Disclaimer - very cool library!

When I use the following in my Project.xml:

<window if="web" orientation="portrait" fullscreen="false" width="160" height="120" background="#00FF00" />

Compile to Flash from FlashDevelop, launches in FlashPlayer at 160x120 (correctly) Compile to HTML5 from FlashDevelop, launches in Firefox/Chrome at fullscreen (incorrectly).

The above config setting is getting it correctly because I can see the #00FF00 color while the game loads.

YellowAfterlife commented 10 years ago

In the same time, if you are later to resize the Flash Player, the game takes the whole of window inner space, which is also exactly what bitfive does right now. The only difference is that FlashDevelop cannot order browser to launch a window of specified size, like it can do with Flash Player. If desperately needed, you can get around that by opening a window via JavaScript, but that's a far-off method, and game area size has virtually no effect on performance, as long as the area outside the game remains empty.

cjke commented 10 years ago

Sorry my bad I didn't explain that correctly, or more accurately gave it a wrong comparison.

Using the above settings, and running the compile against html5 the canvas is set to the windows dimensions. I thought the canvas should be set to 160x120 regardless of the parent divs or window. If the width/height was set to 0/0 then it would be 100%/100%.

I understand what you mean about the behavior of the flash window, and it stretches if the window stretches, but the starting width/height does match the window width/height in Project.xml.

In saying all this, this is intended behavior close the issue.

See image

Thanks

YellowAfterlife commented 10 years ago

Having dropped a link to HaxeFlixel chat I thought that someone will come help you here, but apparently no one did. Oh well. HaxeFlixel has a default behaviour associated with stretching game to fill entire window. You can disable that somewhere. That's something to ask about in HaxeFlixel repository though. Not this one.

cjke commented 10 years ago

Ok fair enough, I wasn't sure which layer was handling the canvas. Thanks! Good work btw!