简体   繁体   English

如何在Delphi XE5下找到解决方案

[英]How to find Resolution under Delphi XE5

I started to develop a game under Delphi XE5 for iOS. 我开始在Delphi XE5 for iOS下开发游戏。 I have problem with the Resolution feature of the Firemonkey. 我对Firemonkey的Resolution功能有疑问。

When I open the screen and I check resolution on the iPhone I get 320x480. 当我打开屏幕并检查iPhone的分辨率时,我得到320x480。 But the native resolution of the iPhone 4 and 5 is doubled. 但iPhone 4和5的原生分辨率翻了一番。 I found at official Delphi pages that FireMonkey is recalculating the screen by "Resolution" which is for Retina display 2. 我在官方Delphi页面上发现FireMonkey通过“Resolution”重新计算屏幕,这是用于Retina显示屏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?) 我的问题是 - 有没有办法找到实际的分辨率值或至少是什么是实际的设备类型(iPhone,iPad?)

thanks 谢谢

ok, we found the answers. 好的,我们找到了答案。

There is unit FMX.Platform that procides quite vital data. 有单位FMX.Platform,它可以产生非常重要的数据。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM