Changing canvas size for tablets

Monkey Targets Forums/Android/Changing canvas size for tablets

Gary Leeds(Posted 2011) [#1]
Have read though the thread here http://monkeycoder.co.nz/Community/posts.php?topic=531#5405 about changing canvas sizes but I am getting errors when I change the androidmanifest file to the example in the thread

I have an Asus EEE pad and am just getting things set up on it. I have downloaded the blob monster demo and the graphic will only move in the top half of the screen no matter what I try and do to force it to the bottom. How can I tell Monkey that my device screen is bigger than normal for an Android device?

Thanks
Gary


GfK(Posted 2011) [#2]
You're better off using virtual resolutions - that way it'll work on anything.

Have a look in Monkey/bananas/hitoro for the autofit example. Also he posted an updated version of it on here quite recently.

[edit] http://www.monkeycoder.co.nz/Community/posts.php?topic=1500

Can't comment on how well it works in Android but it works perfectly well in HTML5 and iOS, so will probably be the same on Android too.


muddy_shoes(Posted 2011) [#3]
This isn't an issue that requires changing the manifest. The blobmonster demo code is just written with hard-coded screen resolution values in the Update method:

y = (15 * Cos(time * -6)) + (240 + (180 * Sin(time * 1.3)))
x = (15 * Sin(time * -6)) + (320 + (200 * Cos(time / 1.5)))


If you changed those to something like:

y = (15 * Cos(time * -6)) + (DeviceHeight()*0.5 + (DeviceHeight()*0.4 * Sin(time * 1.3)))
x = (15 * Sin(time * -6)) + (DeviceWidth()*0.5 + (DeviceWidth()*0.4 * Cos(time / 1.5)))


...the monster should happily wibble around whatever screen you're using.