Game doesn't stretch completely to edge of screen (temporary fix?)
rduke1982 opened this issue · comments
I was having some issues with the game not stretching to the edge of the screen. This error occured on my mac as well as HTML builds. I am using both 512*512 for the game project settings and the custom script.
Here are some examples.
https://monosnap.com/direct/n7dCEGqGB8HW5971EsQ0J4i0iy0uBu
https://monosnap.com/direct/zpHBUkIfcDlKvsPZS8vrXUKmWngujk
I ended up fixing the problem by copying the required files from the template and making the following changes (i.e., using * 2 in the following lines: 116,117 and 122,123):
local function draw_upscaled(self)
-- calculate zoom
local window_width = render.get_window_width() * 2
local window_height = render.get_window_height() * 2
...
-- positioning
local width = self.width * 2 * zoom
local height = self.height * 2 * zoom
...
end
Result:
https://monosnap.com/direct/tq8FaD30vffamqjSdKNfFaJmtW9P64
https://monosnap.com/direct/qMy5jI2ZTCPYTc6VivQEHKuuJ9D0NU
Maybe there's a better way? The description under scale snapped says:
"The upscaled low-res texture will by default be scaled to fill as much of the window as possible."
But that doesn't seem to be the case. Or maybe I didn't understand the last part of the message about zoom.
I think this is because you are testing on a Retina (2x) screen. There is no way in the Defold APIs to detect this. DefOS has a function to get the screen scaling though.
Thanks. I had read about this but wasn't sure if it was the reason. I think the best way to find out if this issue is fixed or not is to have non-Retina screens test the game.