Open greay opened 3 years ago
Hard to say what's wrong. If you can share (bjorn@defold.se) your project or a sample project showing this problem I'd be happy to take a look.
It's pretty easy to reproduce. I made a brand new project, only using Monarch and lowrezjam. Monarch's probably unnecessary, but it's what I'm using for all my GUI/scene transitions.
the sample project just has 1 collection with a GUI, and a single 240x240 box in the center of the screen. But with the project set to use the lowrezjam, the box is larger and somewhat offscreen.
I took a very quick look and it seems to happen when using a Retina screen (which explains the x2 size). I have not figured out a solution yet.
well I can use DefOS to query the scaling factor:
local displays = defos.get_displays()
local display_id = defos.get_current_display_id()
local modes = defos.get_display_modes(display_id)
-- pprint(modes[1]) -- Print information about the first available resolution mode
if modes[1].scaling_factor ~= 1 then
print("screen scaling factor is "..modes[1].scaling_factor)
end
but I'm not exactly sure where to plug that info in
okay an update: setting "Adjust Reference" to disabled in my GUIs 100% fixed the visual sizing issue!
the mouse targets are still off, though.
An alternative approach would be to use the Orthographic camera with a fixed zoom. This way you get mouse input and everything else working out of the box. Here's an example:
https://github.com/britzl/defold-orthographic/tree/dev-lowrez
using the custom.go for a 960x640 pixel game, I switched out my render script for the lowrezjam one and all the collections & tilemaps look great, but all of my GUI is enormous – it appears to all be rendered at at least 2x, leaving much of it offscreen.
Additionally, the touch targets appear to be for their "actual" position, not where they're rendered.