Delphi XE5下如何找到分辨率 [英] How to find Resolution under Delphi XE5

查看:36
本文介绍了Delphi XE5下如何找到分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始在 Delphi XE5 下为 iOS 开发游戏.我对 Firemonkey 的分辨率功能有疑问.

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

当我打开屏幕并检查 iPhone 上的分辨率时,我得到 320x480.但是 iPhone 4 和 5 的原始分辨率增加了一倍.我在 Delphi 官方页面上发现 FireMonkey 正在通过 Retina display 2 的分辨率"重新计算屏幕.

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.

我的问题是 - 有没有办法找到实际的分辨率值,或者至少是实际的设备类型(iPhone、iPad?)

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

谢谢

推荐答案

好的,我们找到了答案.

ok, we found the answers.

有一个单元 FMX.Platform 可以提供非常重要的数据.

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;

结果值为:

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

这篇关于Delphi XE5下如何找到分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆