Is there a way to detect which display profile is in use?


The project I am working on is using a camera zoom (fixed fit projection) value of 0.65. The 2D artist I am working with used the high dpi option and it resulted in the zoom level changing dramatically (from close up to far away). Both of the screenshots I am posting are from iPhone 11.

Large Cake

Small Cake

In an HTML browser, everything seems to be fine as it looks like the original large cake. Is there a proper method to normalize the zoom level across different devices or would I have to use conditional logic to detect the current display profile or something like that?

You can use the DefOS extension to query the current display scale (not sure about exact name). Use this when deciding zoom level.

1 Like

DefOS currently only supports macOS, Windows, Linux, and HTML5.

1 Like

Thanks @britzl and @Pkeod! I was able to import and use this for my project without any problem at all :grinning_face_with_smiling_eyes:


@britzl Sorry for reviving this issue, I actually didn’t realize one issue until today. It seems that I am getting the wrong numbers when using defos.get_window_size()

I’ve set up height brackets to change initial zoom and devices that should be in bracket E are in bracket F. There is an instance of a device that is getting C when it should be in A. There are other strange issues like this. I am querying height.

I expect to not get the full height in browsers because the address bar and other bits will shrink the size. I wonder if the game.project resolution (720x1280) is maybe causing this issue? I’ve posted code snippets below:

This is how I am using defOS:

x, y, w, h = defos.get_window_size()
print("window dimensions: " .. w .. "x" .. h)

This is the bracket sorting I am doing:

if (h >= 2500) then
		preset = zoomPresets.bracketA
	elseif (h >= 2048) then
		preset = zoomPresets.bracketB
	elseif (h >= 1600) then
		preset = zoomPresets.bracketC
	elseif (h >= 1300) then
		preset = zoomPresets.bracketD
	elseif (h >= 1024) then
		preset = zoomPresets.bracketE
	elseif (h >= 740) then
		preset = zoomPresets.bracketF
		preset = zoomPresets.default

Have you tried get/set view size instead of window size?

I haven’t tried that yet but, in editor it seems to get a smaller number than the window size method returns.

get_window_size() = 1088
get_view_size() = 1041

So it’s a bit less accurate as the number I want is 1090. My team has provided me with a table to better illustrate the issue:

Have them send you screenshots too. It’s best to make sure the pixel sizes actually match up.