replit / kaboom

💥 JavaScript game library
https://kaboomjs.com
MIT License
2.66k stars 227 forks source link

Resize of game for different resolutions does not work. #189

Closed ShubhenduVaid closed 1 year ago

ShubhenduVaid commented 3 years ago

Link to my repo https://github.com/ShubhenduVaid/simple-game

slmjkdbtl commented 3 years ago

https://user-images.githubusercontent.com/9929523/132100948-cc2fe80f-3c80-4979-9764-bd24476bb0cc.mp4

Does this by any chance has what you're looking?

ShubhenduVaid commented 3 years ago

Does not work for me. I tried in index.js by adding it but the canvas is taking 100% width and height.

I am looking for something like window resize listener to set the width and height of game here such that it keeps the scaling intact.

It would be helpful to have the game scale well on different resolutions and screen sizes, done via the library.

Here is the config i am using. kaboom({ global: true, fullscreen: true, scale: 2, crisp: false, debug: false, clearColor: [0, 0.4, 0.6, 0.6], canvas: document.getElementById("game"), width: 640, height: 480, });

slmjkdbtl commented 3 years ago

Yeah dynamic sizing on window resize is not there but planned

lajbel commented 1 year ago

Already added in latest @next (from alpha 1)