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
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.