Re:Andromeda Invaders: A retro-style game written in HTML5, ...
by JKCalhoun on Saturday January 21, 2023 @10:38AM
(#34467118)
I see you specify a fixed context width/height. That's fine — who can guess what size the user's browser window will be....
I think in that scenario though you ought to create your own "off-screen canvas" to render your sprites/drawing/text to. Then when you have completed the render/loop, draw from your offscreen canvas's context to the browser canvas's context.
As another replied, you can probably change the scaling attribute (turn off imageSmoothingQuality) to get what you want.
I think in that scenario though you ought to create your own "off-screen canvas" to render your sprites/drawing/text to. Then when you have completed the render/loop, draw from your offscreen canvas's context to the browser canvas's context.
As another replied, you can probably change the scaling attribute (turn off imageSmoothingQuality) to get what you want.