{"assets":[],"author_link":"author\/bigosaur\/","author_name":"bigosaur","cat":"October Challenge 2014","categories":["October Challenge 2014"],"comments":[],"epoch":1412326380,"event":"","likes":3,"metadata":{"p_key":"82025","p_author":"bigosaur","p_authorkey":"0","p_urlkey":"292757","p_title":"Handling different device resolutions for Android","p_cat":"October Challenge 2014","p_event":"LD30","p_time":"1412326380","p_likes":"3","p_comments":"0","p_status":"WAYBACK","us_key":null,"us_name":null,"us_username":null,"event_start":"1408665600","event_key":"24","event_name":"LD30"},"source_url":"2014\/10\/03\/handling-different-device-resolutions-for-android\/","text":"<p>For my first Android project I made a mistake of only testing on a single device. This time I decided to to extensive research to make sure my game looks great on all Android devices from 800\u00d7480 to 2560\u00d71600 pixel screens. After two days of research and testing and made this guide for all the Android developers;<\/p>\n<p><a href=\"http:\/\/bigosaur.com\/blog\/31-android-resolutions-definite-answer\" title=\"Handling different screen resolutions in Android\">http:\/\/bigosaur.com\/blog\/31-android-resolutions-definite-answer<\/a><\/p>\n<p>I\u2019m making all the graphics in 6 different sizes, scaled from 100% for 800\u00d7480 screens to 320% for 2560\u00d71600. I\u2019m using letterboxing with 16:9 being the base resolution, but instead of plain black background I\u2019m using a filler-background so the whole screen is full with some graphics. The \u201caction\u201d takes place only in the central 16:9 space though. It should cover 99% of devices out there. Here\u2019s my main menu:<\/p>\n<p><img alt=\"\" border=\"0\" src=\"http:\/\/bigosaur.com\/blog\/images\/2560gos.png\"\/><\/p>\n<p>I plan to automate most of it with ImageMagick. The workflow would be like this:<\/p>\n<p>1. draw everything for the largest resolution<br\/>\n2. scale images (svg where possible, jpg otherwise)<br\/>\n3. for any overlay text, use imagemagick to add it on the shrinked image using the appropriate font size<\/p>\n<p>As you can see in my blog post 2134\u00d72733 is needed if you simply want to scale the image down to any resolution. This enables you to use the single \u201cscale\u201d multiplier in entire game. Whenever you need a fixed coordinate, just multiply by the scale factor and you\u2019re done. At least, for Sprites. If you\u2019re using libGDX Stage, then you also need to offset each coordinate against the screen center, because libGDX Stage coordinates start in bottom-left corner which might be different on aspect ratios other than 16:9.<\/p>\n<p>Well, I hope this helps anyone who makes 2D games for Android. I still see some very popular games not doing this right. For example I got CubeMen from the Humble Bundle and menus are so small on Nexus 10 that you can barely read text or touch the correct button.<\/p>","time":"October 3rd, 2014 8:53 am","title":"Handling different device resolutions for Android","title_was_empty":false}