I have always developed web clients to work in landscape mode, and when the device is rotated an external JS detects it and shows a message above the application to ask the user to rotate the device back to landscape.
Now I need to adapt the contents of the future applications to the two orientations: how can I dynamically change the window size by swapping the default width and height?
I tried to install extension-orientation but… it doesn’t exist anymore in haxelib!
I tried myself by doing
var originalHeight: Int = Lib.application.window.height; Lib.application.window.height = Lib.application.window.width; Lib.application.window.width = originalHeight;
The result is the same: the window does not resize, or at least the visible contents, but the interactive areas (of the buttons) are rescaled accordingly. I know where the interactive areas are because mouse_over triggers different texts for each button in the client.
The new size of the interactive areas related to the corresponding buttons are
width = original width * 16:9
height = original height * 9:16
and the position
x = original x * 16:9
y = original y * 9:16
I am only rescaling the “interactive layer”, my approach is totally wrong.