WIP Hi-DPI support on HTMl5


CX Code Contributor
3rd Party Module Dev
3rd Party Tool Dev
Nov 19, 2019
I attached a modified version of html5game.js that has some modifications that enable hi-DPI support on HTML5. The modifications are marked with "grant Hi-DPI edit". It checks if the browser scaling (window.devicePixelRatio) has changed on each frame, so it will detect if the DPI changes mid game.

Also I added this line to the head tag of CerberusGame.html
<meta name ="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />


  • html5game.js
    13.9 KB · Views: 82
Last edited:
Does this effect performance and devices with no high-dpi support?

Edit: I guess not.
Last edited:
I wish you would have added your changes to the latest version of the html5games.js file. :-/
I see you got the latest version up for Mac yesterday. I'll grab it before my next changes.
Last edited:
So, had time to test this more properly. Resizing a browser window or pulling the splitter in the window scaled up the canvas to an unusable size. :eek: Not good. Touch coordinates also report back wrong.
Last edited:
Top Bottom