Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / resolution and inch

Author
Message
Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 20th Feb 2013 10:00
Hi everyone,

How can I know the inch of a device? I would like to control the sprite sizes according to the device size (in inch)

Thanks
Talairina
18
Years of Service
User Offline
Joined: 9th Jan 2006
Location: United Kingdom
Posted: 21st Feb 2013 12:57
I assume you mean by display and not device size itself. I find this Wiki page a wonderfuly helpful aid in discovering device display sizes, aspect rations and resolutions.

Wikipedia
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 21st Feb 2013 13:05
i think you mean dpi dots per inch
for android (java)

http://developer.android.com/reference/android/util/DisplayMetrics.html
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 21st Feb 2013 14:26
@Juande:

And remember, that on a rooted android device the user might have customized the DPI settings so that the DPI reported by the device does not reflect the "actual" DPI on-screen. (Such a customization is useful for making the GUI smaller (ie. text, buttons, decorations, etc), giving more work area at the expense of smaller GUI elements.)

If you need one-to-one correspondence between dimensions on the screen and in the real world, then you might have to give the user a calibration option. Not so bad, since it would only have to be calibrated once per device, and would work on any device. But the user would need to measure your calibration slider with a ruler. It would not be 100% precise.

Cheers,
AgentSam
Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 21st Feb 2013 15:16
I think that I have not explained well.

I wanted to say... the size of the display (yes, Talairina... it's true.. it's display... sorry). But, I don't want a list of size of diferent display...

One example:

You set the virtual resolution to 640x480. Then, you create a button (sprite for example) of 32x32. Now, you take a device of 10" and you can see and touch the button... Now, you take your phone of 2.5"... it's imposible to touch that button!

I thought: if the app knows what is the size, it can resize the sprites and to press the button will be more easy.

I don't know to work in Java... I wanted to say if it was possible with AppGameKit (T1)

Thanks!
Talairina
18
Years of Service
User Offline
Joined: 9th Jan 2006
Location: United Kingdom
Posted: 21st Feb 2013 16:53
Percentage based resolutions will solve that issue for you however it does take a little time to learn to use that system correctly and to it's best potential. It's also entirely possible in Tier 1 and 2 also.

You can also use the following functions;



These returns the height in pixels of the current device's screen. Then you can do your sprite size's base on what the device sizes are.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 21st Feb 2013 17:56 Edited at: 21st Feb 2013 17:57
Percentage based measurement doesn't solve the problem unfortunately. I've been pondering this issue myself for a long time. Percentage based simply sets the resolution at 100x100, but stretches the calculations to suit the aspect ratio.

Consider the following scenarios:

1. Desktop with a 21" monitor. AppGameKit resolution set to 640 x 480. Button size = 64 x 48. Button is huge

1b. Desktop with a 21" monitor. AppGameKit resolution set to percentage-based. Button size = 10 x 10. Button is huge

2. Phone with a 3" screen. AppGameKit resolution set to 640 x 480. Button size = 64 x 48. Button is impossible to press

2b. Phone with a 3" screen. AppGameKit resolution set to percentage-based. Button size = 10 x 10. Button is impossible to press

3. Tablet with a 8" screen. AppGameKit resolution set to 640 x 480. Button size = 64 x 48. Button is comfortably pressed

3b. Tablet with a 8" screen. AppGameKit resolution set to percentage-based. Button size = 10 x 10. Button is comfortably pressed

All of the above scenarios represent the exact same button with the exact same dimensions. But the presentation and usability are vastly different between sets 1,2 and 3.

Regarding device resolution, you can have the same physical screen size, but different resolutions. For example I have an old Wildfire with a 320x240 resolution. The new Wildfire is the same screen size, but double the resolution.


I'd love to know the solution.

Talairina
18
Years of Service
User Offline
Joined: 9th Jan 2006
Location: United Kingdom
Posted: 21st Feb 2013 20:41
If we could pull more information about the device from the device using AppGameKit then we could set up better system's for handling the various resolutions, display sizes and aspect rations of the devices.
Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 21st Feb 2013 22:13
It's impossible to discover the display size without a new command about DPI...
Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 21st Feb 2013 23:15
Just add a feature called "Button size" in your game menu, so people can adjust the size if needed.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.

Login to post a reply

Server time is: 2024-05-02 06:11:30
Your offset time is: 2024-05-02 06:11:30