[EDIT2]: I’ve come to the conclusion that this is convenient, and only thing missing is a mention in the docs.
[EDIT] : This seems to be SDL’s doing?
I’ve run into this issue, that messes up counting clicks/taps
On Android and IOS, Monkey sends both Mouse Messages and Touch Messages, for the same event.
(I have not yet tested on a Windows Tablet )
In Monkey-X this was convenient, but since Mx2 splits up the event’s, it’s a bit confusing.
As far as I can find, there are no mentions in the docs of this behavior.
Run this example on Android or IOS to see clickcounter going up in steps of 2.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Namespace myapp
# Import "<std>"
# Import "<mojo>"
Using std . .
Using mojo . .
Class MyWindow Extends Window
Field clickcount : Int
Method OnTouchEvent ( event : TouchEvent ) Override
If event . Type = EventType . TouchDown
clickcount += 1
Print "OnTouchEvent " + clickcount
Endif
End
Method OnMouseEvent ( event : MouseEvent ) Override
If event . Type = EventType . MouseDown
clickcount += 1
Print "OnMouseEvent " + clickcount
Endif
End
Method New ( title : String = "Clickcount mojo app" , width : Int = 640 , height : Int = 480 , flags : WindowFlags = Null )
Super . New ( title , width , height , flags )
End
Method OnRender ( canvas : Canvas ) Override
App . RequestRender ( )
canvas . DrawText ( "Clicks: " + , Width / 2 , Height / 2 , . 5 , . 5 )
End
End
Function Main ( )
New AppInstance
New MyWindow
App . Run ( )
End