- Joined
- Jul 31, 2017
- Messages
- 500
Hi there
I stumbled across this problem: When I turn my mobile device, the screen "size" doesn't adapt properly. It looks like the output is limited to a window with the same dimension as before. It only happens in mojo2. This code demonstrates the problem
The few comments help you to quickly switch between mojo and mojo2.
What am I missing? Is there a solution (other than using mojo )?
Greetings
I stumbled across this problem: When I turn my mobile device, the screen "size" doesn't adapt properly. It looks like the output is limited to a window with the same dimension as before. It only happens in mojo2. This code demonstrates the problem
Code:
Strict
' set to false for mojo2
#If False
Import mojo
Const BG_COL:Int = 128
Const FG_COL:Int = 204
#Else
Import mojo2
Const BG_COL:Float = 0.5
Const FG_COL:Float = 0.8
#End
Global WIDTH:Int
Global HEIGHT:Int
' set to false for mojo2
#If False
#Else
Global canvas:Canvas
#End
Class MyApp Extends App
Method OnCreate:Int()
' set to false for mojo2
#If False
SetUpdateRate(60)
#Else
canvas = New Canvas
#End
Layout()
Return 0
End
Method OnResize:Int()
Layout()
Return 0
End
Method Layout:Void()
WIDTH = DeviceWidth()
HEIGHT = DeviceHeight()
End
Method OnRender:Int()
Local x:Float = (Millisecs() Mod 2000) / 2000.0 * WIDTH * 2
' set to false for mojo2
#If False
SetScissor(0, 0, WIDTH, HEIGHT)
Cls(BG_COL, BG_COL, BG_COL)
SetColor(FG_COL, FG_COL, FG_COL)
DrawOval(x - WIDTH / 2, 0, WIDTH / 2, HEIGHT / 2)
SetScissor(0, 0, WIDTH / 2, HEIGHT)
DrawOval(x - WIDTH / 2, HEIGHT / 2, WIDTH / 2, HEIGHT / 2)
#Else
canvas.SetScissor(0, 0, WIDTH, HEIGHT)
canvas.Clear(BG_COL, BG_COL, BG_COL)
canvas.SetColor(FG_COL, FG_COL, FG_COL)
canvas.DrawOval(x - WIDTH / 2, 0, WIDTH / 2, HEIGHT / 2)
canvas.SetScissor(0, 0, WIDTH / 2, HEIGHT)
canvas.DrawOval(x - WIDTH / 2, HEIGHT / 2, WIDTH / 2, HEIGHT / 2)
canvas.Flush()
#End
Return 0
End
End
Function Main:Int()
New MyApp
Return 0
End
The few comments help you to quickly switch between mojo and mojo2.
What am I missing? Is there a solution (other than using mojo )?
Greetings