Results 1 to 8 of 8

Thread: Android: Support all aspect ratios

  1. #1

    Question Android: Support all aspect ratios

    I wonder is there any easy way to support all common Android resolutions with 4:3 and 16:9 aspect ratios? Something like in provided solution for another Android game engine.a
    http://blog.gemserk.com/2013/01/22/our-solution-to-handle-multiple-screen-sizes-in-android-part-one/

  2. #2
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    you should check out ZenGl, it has Android support and possibly the answers you seek
    http://www.zengl.org/

  3. #3
    Quote Originally Posted by Carver413 View Post
    you should check out ZenGl, it has Android support and possibly the answers you seek
    http://www.zengl.org/
    wasn't it discontinued?

  4. #4
    ZenGL is discontinued,but stable enough for rapid Android games development using Pascal programming language. There is a function scr_CorrectResolution which keeps aspect ratio on all DPIs,but leaves empty black borders. There should be some tricks for adjusting game screen perfectly.

  5. #5
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    Vector graphics is the best way to go but I don't really know what sort of game your planning. with opengl you can change the viewport/aspect but I don't know what that would really look like.
    google would be your best source.
    http://developer.android.com/guide/p...s_support.html

  6. #6
    There is one method, but you need to modify the code of ZenGL and do some calculation E.g. you have real resolution 1280x720. This is a 16:9 aspect. Take any demo, there is resolution 800x600. For aspect 16:9 you need only 800x450. So, you call in your Init this:
    Code:
    zgl_Enable( CORRECT_RESOLUTION );
    scr_CorrectResolution( 800, 450 );
    But as a result you won't see the bottom of scene. E.g. you need to see center of it, so open scr_CorrectResolution and add there this line(before SetCurrentMode):
    Code:
    scrAddCY := Round( -75 * scrResCY );
    -75 - this is ( 600 - 450 ) / 2. So, if idea is clear then you can modify the code a bit an extend it for your needs
    Last edited by Andru; 08-05-2014 at 07:25 AM.

  7. #7
    Thanks for the answer. I will try to center all the UI in safe area and leave some pixels around for the background.
    Mystic Diary - Hidden Object has good stretching on all resolutions with status bar and without it.

  8. #8
    Mystic Diary has been made without saving the aspect(this is a default practice of published on BFG games), but because of content it's not so clear

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •