Scaling down browser window blurs content in html5

I have a 1920x1080 html5 canvas, looks perfect on full screen, but when I scale down the browser window, evrything gets blured.
Some sizes gets more blured than others, seems to be random. The blur never is too strong but itโ€™s noticeable. What can I do to fix this?

Do you listen to the resize event and resize accordingly?

Iโ€™m not 100% sure this is necessary but would make sense.

Iโ€™m not listening to the resize events, the default way of resizing when you build the game and test it on the browser is OK for me. Iโ€™m usign that.

OpenFL (by default) should either let you choose a window width and height (which will then CSS scale if the user has a smaller or larger window open) or will set your canvas to the userโ€™s window size, and you listen to Event.RESIZE (or just poll stage.stageWidth and stage.stageHeight) to render based on the current screen size

How do I switch to a Event.RESIZE driven scaling? Should I disable CSS resizing somewhere, then suscribe to Event.RESIZE? That should fix the issue?

You can either not define <window width="" height="" /> in your XML, or set it to 0x0, like <window width="0" height="0" />

Then you would do something like:

stage.addEventListener (Event.RESIZE, stage_onResize);

Then handle the updated stage.stageWidth and stage.stageHeight in your handler :slight_smile:

Thanks, the blur issue was fixed setting with and height to โ€œ0โ€ and managing the scaling inside the Haxe code on the Stage.Event.resize. Just as singmajesty said.
โ€œ0โ€ is better than empty string โ€œโ€, because setting an empty string breaks the flash build.

1 Like