Multiple Resolution Mojo.

Monkey Targets Forums/Android/Multiple Resolution Mojo.

Xyloman(Posted 2013) [#1]
Dose anyone know how i cant get mojo to scale the game so it will fit on multiple resolutions and screen sizes.


bruZard(Posted 2013) [#2]
create and load your gfx for a max resolution (for example HD: 1920x1080) and draw them with a ratio:

ratio = Float(DeviceWidth()) / 1920.0
DrawImage(myHDImage, x * ratio, y * ratio, 0.0, ratio, ratio)



Xyloman(Posted 2013) [#3]
Im still new to monkey and not quite sure what you mean. Sorry.


Midimaster(Posted 2013) [#4]
In a very simple way you need only one command at the beginning the OnRender() method. Lets say you code everything on a "virtual" resolution of 800x480:

Method OnRender()
     local scaleX#=DeviceWidth()/800.0
     local scaleY#=DeviceHeight()/480.0
     Scale scaleX, scaleY
     ' that's all you need, it simulates a screen of 800x480pix

     ' from now on you can do everything, what you would do on a 
     ' 800x480pix resolution screen. all values will always fit 
     ' to the device screen:

     ' full red screen:
     SetColor 255,0,0
     DrawRect 0,0,800,480

     ' right half green
     SetColor 0,255,0
     DrawRect 400,0,400,480  
End



SLotman(Posted 2013) [#5]
Look for the autofit module. Works like a charm.


silentshark(Posted 2013) [#6]
I second slotman's advice


Supertino(Posted 2013) [#7]
yup Autofit ( http://www.monkeycoder.co.nz/Community/posts.php?topic=1500#57451 )does it all for you. Just remember you might need to do some extra work to accommodate different aspect ratios else you'll get black bars top/bottom on some devices.