Fixing blurry images:
I enlarged the game content by double and then reduced the canvas size by half.
// keep ratio
float scaleX = (w * 2) / (float)fWidth;
float scaleY = (h * 2) / (float)fHeight;
//reduced canvas size
emscripten_set_element_css_size("canvas", w / 2, h / 2);
- Fixing FPS flow issues:
Based on this #699
- Fixing crashes when zooming:
I realized that at certain screen sizes, the width or height values of the content would return 0. So, I reassigned them.
```c++
if (w == 0 || h == 0)
{
w = jsContextGetWindowWidth();
h = jsContextGetWindowHeight();
}
I have implemented this sample a few months ago, and it works well with various projects.
https://github.com/kan6868/s2d-html-template
//reduced canvas size emscripten_set_element_css_size("canvas", w / 2, h / 2);