如何在Delphi XE5下找到解决方案 [英] How to find Resolution under Delphi XE5

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

问题描述

我开始在Delphi XE5 for iOS下开发一款游戏。我有Firemonkey的分辨率功能的问题。



当我打开屏幕,我在iPhone上检查分辨率,我得到320x480。但是iPhone 4和5的本机分辨率翻了一番。我在官方Delphi页面发现,FireMonkey正在通过分辨率重新计算屏幕,这是用于Retina显示屏2。



我认为这对于普通应用来说很酷,但是你开始做游戏,你想通过代码来操作图像,它带来了奇怪的情况。



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



谢谢

解决方案

确定,我们找到答案。



有一个单元FMX.Platform可以处理相当重要的数据。

  var 
ScreenSvc:IFMXScreenService;
begin
如果TPlatformServices.Current.SupportsPlatformService(IFMXScreenService,IInterface(ScreenSvc))然后
begin
<您的代码>
结束
结束

,结果值为:

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


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

解决方案

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

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

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