tproper Posted October 17, 2018 Share Posted October 17, 2018 I'm using Phaser2 to make a simple game. When I set the game width and height to these: var Screen_Width = window.innerWidth * window.devicePixelRatio; var Screen_Height = window.innerHeight * window.devicePixelRatio; The game runs really slow on my iPhone. What is the problem? Link to comment Share on other sites More sharing options...
jake.caron Posted October 18, 2018 Share Posted October 18, 2018 Constantly resizing the window every frame is computationally expensive no matter the framework. As a solution, instead of doing this every frame, only do this when the window is resized. Here is a bit of code that may help: window.addEventListener('resize', <RESIZE_METHOD>); Link to comment Share on other sites More sharing options...
samme Posted October 18, 2018 Share Posted October 18, 2018 Possibly the canvas is just too big (in pixels). Link to comment Share on other sites More sharing options...
tproper Posted October 18, 2018 Author Share Posted October 18, 2018 Thanks. I figured it out. It was because I was doing something stupid in Phaser. I didn't really understand that you create multiple graphics objects for drawing multiple things. Instead I had one graphic object drawing everything and it worked sometimes and not other times. Thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts