Sample code?
The below code seems to work OK, DeviceHeight returns 1205 on my nexus 7 (or 736 in landscape mode), which sounds about right for 1280 x 800. Also, the android target code just returns _view.getheight() which I'm pretty sure will exclude home button etc height.
If you want to move game graphics above the ad, you should subtract Admob.AdViewHeight from your playfield height - this allows you to 'clear' the area behind the ad any way you want.
Import mojo
Class MyApp Extends App
Method OnCreate()
SetUpdateRate 60
End
Method OnRender()
Cls 255,255,255
SetColor 255,0,0
DrawRect 1,1,DeviceWidth-2,DeviceHeight-2
SetColor 255,255,255
DrawText "DeviceWidth="+DeviceWidth+", DeviceHeight="+DeviceHeight,2,2
End
End
Function Main()
New MyApp
End
|