Hello,
In my game development, I need to get the correspondance between one true unit screen distance (e.g. 1 inch or 1 centimeter)
and the number of pixels associated with this distance. This is because I need to zoom in/out some objects (images) but I
want them to be still visible.
There is the function love.windows.getDPIScale(), but it does not return what I want.
Is there anyway from love to get the DPI screen value ?
Actually, it would be cleaner to talk about the PPI (Pixel Per Inch).
Regards
EDIT :
I guess my question is a bit out of love scope.
I am not sure the DPI/PPI is accessible in windows, but at least one can calculate it with the screen dimension, e.g. 1600x1200 pixels,
and the screen diagonal, expressed as 13", 24", ...
So the more precise question would be : is it possible to retrieve the screen diagonal from love ?
Get the screen DPI/PPI
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Get the screen DPI/PPI
At least, there is a programmatic way to get the screen dimensions in windows 10 shell :
which, among other things, outputs :
InstanceName : DISPLAY\MEI96A2\4&289d63ab&0&UID265988_0
MaxHorizontalImageSize : 29
MaxVerticalImageSize : 19
I personnally recognize the horizontal and vertical size in centimeters of my screen.
It should not be too difficult to wrap this powershell script into a lua subprocess and postprocess its output.
Regards
Code: Select all
Get-WmiObject -Namespace root\wmi -Class WmiMonitorBasicDisplayParams
InstanceName : DISPLAY\MEI96A2\4&289d63ab&0&UID265988_0
MaxHorizontalImageSize : 29
MaxVerticalImageSize : 19
I personnally recognize the horizontal and vertical size in centimeters of my screen.
It should not be too difficult to wrap this powershell script into a lua subprocess and postprocess its output.
Regards
Re: Get the screen DPI/PPI
Yeah, this is a bit out of scope for LÖVE. You could just ask the user what the size is, if it's important.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Re: Get the screen DPI/PPI
There's SDL_GetDisplayDPI, maybe you can access it using FFI. But I wouldn't trust the value too much. Perhaps to use it as a default to ask the user as ReFreezed suggested.
Who is online
Users browsing this forum: Google [Bot] and 6 guests