I already changed the game.project>Display>Width/Height. I understand that this is the logical resolution. I’m good with how it adapts to device’s screen size / resolution. What I wanna change is the window size when I press Cmd+B (Build). Since I’m working on a laptop, the height ain’t enough to the default window size hence I get black pillars (I’m fine with the pillar as it is the result of being responsive). What I want is change the window size so I get to develop and test quickly experiences my intended aspect ratio. I can tackle the “responsive” part later on.
I tried looking for answers and found that I can display-width and display-height fields in the game.project but it didn’t work. In fact, it fails the build.
do I put this in the render_script? I just did this:
function init(self)
-- Add initialization code here
-- Learn more: https://defold.com/manuals/script/
-- Remove this function if not needed
msg.post("@render:", "resize", { width = 230, height = 500 })
end
It did change the window size (some milliseconds after it loads up the window) but it just shows a black screen. Where should I put this script?
gotcha! I saw the main.script. Quick (off-topic) question, if you want to initialize the game and you put your logic in main.script. How do you guarantee that main.script will run first before other.script? In case you require to run some logic in the init() of main.script and you don’t want other.script to run before main.script.
Quick follow up, where can you find the available messages? In this case, you can send “resize” to “@render”. I saw another message - “use_fixed_fit_projection”. I tried pressing CTRL+Space to check auto-complete / intellisense but “resize” and “use_fixed_fit_projection” didn’t appear.
I usually have a bootstrap collection with an attached main.script where I do all the platform initialization. Then I load any other collection needed via collection proxy.
Proxies are a powerful concept if you think about them in terms of your states (menu, game, levels, etc)