You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys! Another tip for your games. If you're interested in filling the entire browser window with your game, I noticed there's not a lot of good, simple, easy-to-follow examples on Google. In fact, a lot of answers you find on the internet are really really complicated.
Here's the simple solution...
/* In your CSS */* {
padding:0;
margin:0
}
body {
overflow: hidden;
}
#canvas {
width:100vw;
height:100vh;
}
// In your game/scene config
scale: {width: window.innerWidth,height: window.innerHeight,autoCenter: Phaser.Scale.CENTER_BOTH}
This will fill the viewport with your game, and Phaser 3 is smart enough to automagically adjust your game's scale and viewport if the viewport size changes as well. 😄
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys! Another tip for your games. If you're interested in filling the entire browser window with your game, I noticed there's not a lot of good, simple, easy-to-follow examples on Google. In fact, a lot of answers you find on the internet are really really complicated.
Here's the simple solution...
This will fill the viewport with your game, and Phaser 3 is smart enough to automagically adjust your game's scale and viewport if the viewport size changes as well. 😄
Beta Was this translation helpful? Give feedback.
All reactions