Jump to content


Photo

Screen dpi?


  • Please log in to reply
10 replies to this topic

#1 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 2847 posts
  • Version:GM:Studio

Posted 04 March 2012 - 07:28 AM

Hi, i've been messing around with GM:S for android (i dont own any IOS devices to test but i guess the issue remains the same), and so far the best code to addat to multiple screen sizes and resolutions is this one:
view_wview = display_get_width();
view_hview = display_get_height();
view_wport = display_get_width();
view_hport = display_get_height();

Now, this DOES work, but my concern is that, what i see on a normal size on my phone, will look GIANT on a tablet, because the screen size is waay bigger and you cant know how many pixels per inch the screen size. Google provides some DPI functions to avoid this issue but i have not found any of this on GM:S, just by letting us know how many dots per inch the screen has, its enough to make a simple calculation and scale the objects to the same size on all screens:
pixels = dp*(screen_get_dpi()/160)
(where dp is the actual dp units to convert)


So my questions is, can something like 'screen_get_dpi()' be implemented? :)
  • 0

#2 Kouri

Kouri

    GMC Member

  • GMC Member
  • 157 posts
  • Version:GM:Studio

Posted 04 March 2012 - 10:19 PM

I would actually love something like this. Even though a Dell Streak 5 and an HTC G2/Desire Z both use about an 800 x 480 screen resolution, the Streak's 5" screen gives you a lot more room to work with than the G2's 3.7" screen. Moreover, some lower end 7" chinese models use that 800 x 480 resolution, so being able to change the UI when DPI drops under... say 160, would be wonderful.
  • 0

#3 cotycrg

cotycrg

    GMC Member

  • GMC Member
  • 851 posts
  • Version:GM:Studio

Posted 04 March 2012 - 11:26 PM

I second this motion.
  • 0

#4 mazimadu

mazimadu

    GMC Member

  • GMC Member
  • 203 posts

Posted 07 March 2012 - 03:15 AM

I don't really understand the concept of dpi. Could someone explain in the context of GM. Much apprecieated.
  • 0

#5 Camman

Camman

    UnReal Software CEO

  • GMC Member
  • 634 posts
  • Version:GM:Studio

Posted 07 March 2012 - 04:19 AM

It's how many pixels are shown per inch of screen space (comes from a printing term meaning Dots Per Inch).

A 5" screen could have the same resolution as a 3" screen, but the DPI for the 3" screen would be greater (more pixels in less space).
http://en.wikipedia.org/wiki/Pixels_per_inch
  • 0

#6 King Tetiro

King Tetiro

    King of Orenna

  • GMC Member
  • 2180 posts
  • Version:GM8

Posted 07 March 2012 - 09:40 AM

Would someone mind explaining the possabilities if we had this function?
  • 0

#7 NAL

NAL

    凸ʕಠᴥಠʔ凸

  • YoYo Games Staff
  • 686 posts
  • Version:GM:Studio

Posted 07 March 2012 - 09:48 AM

Would someone mind explaining the possabilities if we had this function?


It would mean that creating a universal app for any resolution of phone and any resolution of tablet could be done a lot better.

Say you have an iPad 2 and an iPhone 4. The iPad 2 has a very large screen, and a resolution of 1024x768. The iPhone 4 has a much smaller (like three times smaller each way) screen, BUT only a very slightly different resolution.

Now, if you created an app with the iPad in mind, that's fine. You translate that game to iPhone, however, and it could be far too small - even though it's at a very similar resolution. Similar happens in reverse - if you create an app at 960x640 with text clearly legible on the iPhone, on the iPad the text is going to look huge. I know this from doing the games for YYG - we have to constantly test games on both to make sure something I think works isn't suddenly too small or too big on one of the mobile systems.

A function like this would allow you to work out the literal size of the screen in inches. It could then, for example, allow you to draw text over a number of inches rather than a number of pixels (since pixels have no fixed physical size, they could be building sized or atom sized).

Edited by NAL, 07 March 2012 - 09:48 AM.

  • 1

#8 King Tetiro

King Tetiro

    King of Orenna

  • GMC Member
  • 2180 posts
  • Version:GM8

Posted 07 March 2012 - 09:50 AM

Ok now that I would support. I can see people needing this.
  • 0

#9 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16785 posts
  • Version:GM:Studio

Posted 07 March 2012 - 09:52 AM

Agreed... It seems like a useful function tat could save many man-hours of testing.
  • 0

#10 Mr Game

Mr Game

    GMC Member

  • New Member
  • 177 posts
  • Version:GM8

Posted 07 March 2012 - 03:17 PM

I'll add this to GM Studio Wishlist topic.....
  • 0

#11 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 2847 posts
  • Version:GM:Studio

Posted 07 March 2012 - 04:24 PM

Nice to see the support for this! :)

Here is the Android documentation, for those interested on the possibilities this functions may give us in GMS:
http://developer.and...ns_support.html

Already opened a bugtracker entry too ;)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users