This is for anyone that didn't manage to find a solution or was too lazy to look at the Picotron Documentation (like me).
You can get the window size after the user resized the window with
get_display():width()
and
get_display():height()
, respectively.
To detect when the window is resized, you can use the following code by arnaught:
on_event("resize", function (msg) width = msg.width height = msg.height end) |
Another solution would be to constantly compare a variable to the current screen width and height. From my experience, this is a better solution performance-wise, but you can try both options and see which fits best for your purposes.
function _update() if height != get_display():height() or width != get_display():width() then height = get_display():height() width = get_display():width() end end |



You can also detect when the window is resized and get the width and height with an event.
on_event("resize", function (msg) width = msg.width height = msg.height end) |



Thank you for your reply, arnaught. I’ve included your code snippet in the tutorial.
[Please log in to post a comment]