Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Quad, aliswee), 835 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 4
Page 1 of 2 1 2
Engine window and DPI scaling #480629
06/20/20 22:23
06/20/20 22:23
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline OP
User
Emre  Offline OP
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Hi guys, is there a way to ensure that the engine window is not affected by the windows dpi setting? I can get the real resolution with Superku's code (sys_metrics doesn't give the real resolution when DPI is active.) but i can't adjust the engine window to that resolution. Since my english is not good, i prepared a video to better explain the problem.Click here for video.

Any idea?

Edit: Ok, i found a workaround: Launch the application full screen, then switch to window mode.


Last edited by Emre; 06/23/20 17:02. Reason: Workaround
Re: Engine window and DPI scaling [Re: Emre] #480700
06/30/20 03:49
06/30/20 03:49
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Does this have anything to do with Ultrawide (21:9) monitors?

Re: Engine window and DPI scaling [Re: Dooley] #480702
06/30/20 11:27
06/30/20 11:27
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline OP
User
Emre  Offline OP
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
I don't think the monitor has an effect on the event. As seen in the video, when windows dpi is active, the engine is lowering the resolution, in window mode.

Re: Engine window and DPI scaling [Re: Emre] #480795
07/13/20 15:55
07/13/20 15:55
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
"sys_metrics doesn't give the real resolution when DPI is active."

I just found this little gem in the manual...
"For retrieving the original desktop resolution, this function (sys_metrics) must be called before switching to a different fullscreen resolution - i.e. in lite-C before any level_load() or wait(), and in C-Script before any call or variable setting that would switch to fullscreen mode."

I think this was responsible for my issue (still to be tested) but perhaps you are calling on sys_metrics after a wait() or level_load() ?

Last edited by Dooley; 07/13/20 15:56.
Re: Engine window and DPI scaling [Re: Dooley] #480798
07/13/20 23:24
07/13/20 23:24
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Nope!
It did not solve my problem completely, but I did find out that if dpi is deactivated it starts to work correctly (where it did not before).
So I think my issue should be resolved using the same method as yours, by starting in full screen, and moving to window mode.

I will try that and report back here.

Re: Engine window and DPI scaling [Re: Dooley] #480800
07/14/20 10:57
07/14/20 10:57
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline OP
User
Emre  Offline OP
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Originally Posted by Dooley
So I think my issue should be resolved using the same method as yours, by starting in full screen, and moving to window mode.

Yes, i believe that's the only way and will resolve your problem. By the way, doesn't matter what sys_metrics say. You can get the real resolution with superku's code, nevertheless engine ignore that resolution in window mode. (if dpi is active.)

Re: Engine window and DPI scaling [Re: Emre] #480801
07/14/20 13:38
07/14/20 13:38
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
The player was able to overcome the issue by selecting "Disable display scaling on high DPI settings" under "Properties > Compatibility" in Windows.

Is there a way to have that active by default?

Re: Engine window and DPI scaling [Re: Emre] #480802
07/14/20 14:10
07/14/20 14:10
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline OP
User
Emre  Offline OP
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Yeah i was aware of this and i did research on the internet but i couldn't find how to activate it. That was the main reason i opened this title. (:

Maybe this article can help. I have already given up. Because both my english and my programming skiil are not enough to deal with it.

Re: Engine window and DPI scaling [Re: Emre] #480805
07/14/20 14:45
07/14/20 14:45
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Okay, the manual mentions that "The EXE file contains a manifest that is compatible to the Microsoft Games for Windows standard."

There must be a way to edit or modify that manifest ... is it built from the game's .wdl file?

Re: Engine window and DPI scaling [Re: Dooley] #480806
07/14/20 20:27
07/14/20 20:27
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Okay, I was able to reproduce the problem by setting the DPI scaling on my system to 150%, and trying to run the game in a window at 1600 x 900 (while monitor resolution was set to 1920 x 1080). This failed and opened a smaller window of 720 x 480 (or something). However, after I modified the manifest on the .exe file, as described in your link, it now works, and does not try to scale the screen up.

Here is the link on how to update the manifest: (placed here for anyone else so they don't have to read through all the posts)
https://docs.microsoft.com/en-us/windows/win32/learnwin32/dpi-and-device-independent-pixels

Now, here is a link to a program that allows you to edit the manifest:
http://www.restuner.com/download.htm

There are other ways to do this, but this seemed like the easiest. It is not a free program, but has a 30 day trial. I will probably buy it once that trial is up, since I plan to keep doing this in other projects...

To edit the manifest, first install Resource Tuner, and click yes for the context menu shortcut. Then right click on your game's executable file, and select "Open with Resource Tuner"

You will see three folders, "Icon," "Icon Group" and "Manifest." Open the Manifest folder, and double click the manifest file.

Here is what I used in my manifest.

Code
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
	<ms_asmv2:trustInfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
		<ms_asmv2:security>
			<ms_asmv2:requestedPrivileges>
				<ms_asmv2:requestedExecutionLevel level="asInvoker" uiAccess="false">
				</ms_asmv2:requestedExecutionLevel>
			</ms_asmv2:requestedPrivileges>
		</ms_asmv2:security>
	</ms_asmv2:trustInfo>
	<asmv3:application>
		<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
			<dpiAware>true</dpiAware>
		</asmv3:windowsSettings>
	</asmv3:application>
</assembly>


This combines the existing manifest with the additional stuff provided by the first link to Microsoft above...

For me, it now runs the game correctly, regardless of any DPI scaling. The game is not actually DPI Aware - it does not increase the size of the text or anything - but it will not think the screen is the wrong size as it was doing before.




Last edited by Dooley; 07/14/20 20:29. Reason: spelling
Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1