Screen landscape portrait


#1

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?


#2

You should be able to listen to size changes.


#3

yes, i try with window_rezise but dont work D:


#4

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?


#5


#6

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


#7

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


#8

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?


#9

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


#10

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