Incorrect ZApplication.MousePosition in Preview

Found a bug? Post information about it here so we can fix it!

Moderator: Moderators

Post Reply
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Incorrect ZApplication.MousePosition in Preview

Post by Rado1 »

In the latest Beta, if an application has set ViewportRatio to the value other than "Full window", e.g. 16:9, and it is running in the ZGE Preview panel, the ZApplication.MousePosition is not set correctly. The offset of the returned position depends also on the size of the Preview panel.

See the attached testing project: run it in a Preview which is wider than taller and has some black side strips. Put the mouse to the middle of the screen marked with small yellow point. The white rectangle, determining the mouse position should also be in the middle, but it is not. Change the Preview size and observe that the position offset changes. Try to run it with F9 and see that it is correct.

(Fix is quite urgent since I cannot continue with planned game development.)
Attachments
test.zgeproj
testing project
(1.27 KiB) Downloaded 430 times
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:?

Also, even though ViewportWidth / Height display the correct values when viewing the properties of App, when you access them through a ZExpression they contain the ScreenWidth / Height values instead.

K
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Beta updated. This happened because I earlier tried to fix the issue where Viewport properties were zero during preview.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Post by Rado1 »

Tested the latest beta and the fix works. Thanks Ville!
Post Reply