- Joined
- Jan 2, 2020
- Messages
- 1,284
When you use any browser in Linux and go fullscreen #HTML5_CANVAS_RESIZE_MODE 1 and 2 does not correctly scale mouse/touch coordinates.
Linux stretches fullscreen in only the y -direction and keeps the ratio, bascially centering x. So x is correct in the middle and when you go outward, it will scale more incorrectly the further you go.
Btw in MacOS all browsers stretches fullscreen in both directions, and Windows probably does the same I can't rememebe but I'm sure there' no issue there either as it would have been talked about in that case.
Linux browser fullscreen (default HTML5 mode 1)
Linux stretches fullscreen in only the y -direction and keeps the ratio, bascially centering x. So x is correct in the middle and when you go outward, it will scale more incorrectly the further you go.
Btw in MacOS all browsers stretches fullscreen in both directions, and Windows probably does the same I can't rememebe but I'm sure there' no issue there either as it would have been talked about in that case.
Linux browser fullscreen (default HTML5 mode 1)
Code:
#MOJO_AUTO_SUSPEND_ENABLED = False
#HTML5_CANVAS_RESIZE_MODE=1 '0=locked, 1=stretch, 2=resize'
Import mojo2
Function Main()
New Game
Return 0
End
Class Game Extends App
Field x:Int
Field y:Int
Field canvas:Canvas
Method OnCreate()
canvas = New Canvas()
Return 0
End
Method OnUpdate()
x = Int(MouseX()/8)*8
y = Int(MouseY()/12)*12
End
Method OnRender()
canvas.Clear 0,1,0
canvas.DrawLine x,y,x,y+12
canvas.Flush
End
End