Reset window screen action proportions?

If I make a project with

[display]
width = 640
height = 1136

action.x action.y work as expected

if I make a project with

[display]
width = 240
height = 1136

actions work as expected

However if I start with a

[display]
width = 240
height = 1136

and then resize the actual window to 640x1136 along with render.set_projection changes to fit it then actions work based on the actual window size placing them into the original window size. If I understand right this has to do with screen space vs world space?

Is there a function that would allow me to do whatever Defold does when the engine first opens so that when the real screen is resized from what it originally expects so that as screen is resized the relationship is updated? I expect something is looking at render.get_window render.get_height for the initial relationship but I can’t find where or how to update it directly…

Hmm, ok, not sure if I understand what you are asking for, but you know about action.screen_x and action.screen.y? And you can get the current width and height in the render script using render.get_window_width() and render.get_window_height() as well as original width using render.get_width() and render.get_height() (or read them from game.project using sys.get_config(“display.width”))

I did not know about action.screen_x / action.screen_y, but do not seem to work to solve problem

Sent you PM with sample project

1 Like