How to find Resolution under Delphi XE5

纵然是瞬间 提交于 2019-12-05 23:33:02

问题


I started to develop a game under Delphi XE5 for iOS. I have problem with the Resolution feature of the Firemonkey.

When I open the screen and I check resolution on the iPhone I get 320x480. But the native resolution of the iPhone 4 and 5 is doubled. I found at official Delphi pages that FireMonkey is recalculating the screen by "Resolution" which is for Retina display 2.

I think this is cool feature for regular apps, but when you start to do game and you want to manipulate with images by code it brings weird situations.

My question is - is there way to find the actual Resolution value or at least what is the actual device type (iPhone,iPad?)

thanks


回答1:


ok, we found the answers.

There is unit FMX.Platform that procides quite vital data.

var
 ScreenSvc: IFMXScreenService;
begin
 if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenSvc)) then
begin
   <your code>
 end;
end;

and the result values are:

 ScreenSvc.GetScreenSize.X
 ScreenSvc.GetScreenSize.Y  
 ScreenSvc.GetScreenScale


来源:https://stackoverflow.com/questions/20124191/how-to-find-resolution-under-delphi-xe5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!