How to find Resolution under Delphi XE5
Asked Answered
M

1

7

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

Monocular answered 21/11, 2013 at 14:53 Comment(0)
M
3

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
Monocular answered 24/11, 2013 at 9:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.