Screen landscape portrait


hi, i have a project and i can know when the game is in portrait or landscape in html5 mobile, but i need to set the game in pause when the screen change the orientation. how can i send a message from js to defold for that?


You should be able to listen to size changes.


yes, i try with window_rezise but dont work D:


What’s not working? Don’t you get Windows resize event at all? Could you please post a source code? Did you set up a listener?



Ok, so let’s print anything in window_callback and in pause script when a “show” message is received, and look further


i do it, when i lost the focus the game is paused, and in the defold build when i resize its also paused, but in html5 dont work


Ok, then in HTML build, you can for example use some label inside and set text or save logs to a file to check what’s happening there :wink: what did you mean by sending a message from js to Defold?


i check when the orientation is change in a script in the index file, i want to send something to the game when the orientation change for pausing the game


The print() statement works in HTML5 too. Just open the developer console in your browser to view the log.