Multiple Resolution Mojo.
Monkey Targets Forums/Android/Multiple Resolution Mojo.
| ||
Dose anyone know how i cant get mojo to scale the game so it will fit on multiple resolutions and screen sizes. |
| ||
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) |
| ||
Im still new to monkey and not quite sure what you mean. Sorry. |
| ||
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 |
| ||
Look for the autofit module. Works like a charm. |
| ||
I second slotman's advice |
| ||
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. |