KeyHit with Mouse messed up

Monkey Forums/Monkey Programming/KeyHit with Mouse messed up

Soap(Posted 2013) [#1]
KEY_LMB
KEY_MMB
KEY_RMB

all work as expected - but these other things listed below may confuse new people because they do not work as expected?

For me testing in HTML5 and GLFW, MouseRight is connected to Middle Mouse Button and MouseLeft is connected to Right Mouse Button.

KeyHit(MouseRight) only works when clicking real mouse left
KeyHit(MouseMiddle) only work when clicking real mouse right
KeyHit(MouseLeft) doesn't work at all

It doesn't matter but maybe this isn't expected behavior?

Import mojo

Class RightClickTest Extends App

	Field mouseActive:Bool = False
	Field mouseState:String

	Method OnCreate()
		SetUpdateRate(60)		
	End
	
	Method OnUpdate()
		If KeyHit(MOUSE_LEFT)
			mouseActive = True
			mouseState = "This should be left mouse button"
		ElseIf KeyHit(MOUSE_MIDDLE)
			mouseActive = True
			mouseState = "This should be middle mouse button"
		ElseIf KeyHit(MOUSE_RIGHT)
			mouseActive = True
			mouseState = "This should be right mouse button"
		Else
			mouseActive = False
			mouseState = "None"
		EndIf
	End
	
	Method OnRender()
		Cls(0, 0, 0)
		If mouseActive
			DrawText(mouseState, 10, 200)
			Print mouseState
		EndIf
	End
	


End

Function Main()
	New RightClickTest()
End


Do we really need the MouseHit/Down and JoyHit/Down methods? Shouldn't we use KeyHit/Down for everything?