I'm doing a game kind of responsive to fit various screen ratios. A lot of objects are placed based on viewport size.
Is there any way to detect the changes in viewport? For example, if someone resizes the game window, or change the orientation from landscape to portrait (on a mobile for example), och click the fullscreen button.
There doens't seem to be any system condition to detect changes in viewport size.
Any help appreciated.
Ahhh.. I found it in the browser object how to detect changes in viewport size.
Develop games in your browser. Powerful, performant & highly capable.
You could do something like this...(pseudo code)
every tick--
current_viewport_width = Viewpoint_Width
if current_viewport_width != old_viewport_width
--do stuff
old_viewport_width=Viewpoint_Width //and set the old width to the new one