Hey, i’m kinda new to defold and i accidentally set my game’s resolution to 1280x720 while i have a 1920x1080 monitor which causes windowed mode to be small which is ok but i’m used to pressing f11 and it fullscreens but it doesn’t do that. and when i check fullscreen in game.project it’s messed up (like in the image). also when i exported it to html5 and pressed the fullscreen button it was small too. I really need help because i’ve been trying to fix this issue forever
You should look into view projections. This determines how content within the view port adjusts to different resolutions and aspect ratios.
In some cases, its as simple as:
msg.post(“@render:“, “use_fixed_fit_projection“) or whichever view projection works best for you.
Thanks for the quick reply! That helped me understand what’s going on with the projections.
I tried using
msg.post(“@render:”, “use_fixed_fit_projection”)
but it doesn’t seem to change anything — when I resize the window, I can still see parts of the game world that shouldn’t be visible instead of getting black bars.
I’m using the default render script (/builtins/render/default.render). Do I need to modify something inside the render script itself for this to work, or should the message be enough by itself?
It should work with the default render script.
Do you have a camera component to your collection?
Where did you add the msg.post? It should be in init()
Otherwise, could you please add a gui component to your scene and send the screenshot of your collection here. It should create an outline of your game’s viewport.
i created a new project to test this and it still doesn’t work. when i start(image 2) i only see what is in the outlines(image 3) but when i resize my game i can see the grey rectangle on the right which shouldn’t normally be visible.(image 1) again my goal is to get black bars instead of seeing unseen things when i resize
also this is my goal shown in a game i have on my pc. when i resize it black bars are shown to keep the aspect ratio
The render script does not add black bars by default, you would have to modify it.
Rendercam camera extension if I remember correctly adds black bars but it has not been updated in a while so it might not work on newer versions of Defold.
Personally I add black bars via a GUI and resize them as needed. Should be fairly trivial to do.
Try that: add another box node, colour set to black, adjust mode set to stretch.
Put this box between your outside content and the rest, so it is drawn on top of the things you don’t want to see and below the content you do:
this worked and also ty to all the other people who helped








