Closed DalinSeivewright closed 9 years ago
If you activate mouse controls - you should just be able to access them via Q.inputs['mouseX']
and Q.inputs['mouseY]
https://github.com/cykod/Quintus/blob/master/lib/quintus_input.js#L533
The mouseX and mouseY values can be accessed from anywhere Quintus is accessible from however, the values are only ever updated on mouseMove. Since they are converted to scene coordinates, the coordinates are fixed in the scene until the mouse is moved again.
I was playing around with rotating sprites to face the mouse coordinates, using the mouseControls function of Q.input.
The mouse coordinates are only updated on mouse move, which makes sense, however this causes issues if a sprite is moving and the mouse is not moving. Because the mouse coordinates are transformed into stage space the "mouse coordinates" will continue moving away from the sprite and the rotation of the sprite will continue rotating towards this point in the stage space instead of the actual on-screen mouses position.
I've only started looking at Quintus this weekend so correct me if I'm wrong, but I don't see any way to get the current mouse coordinates at any given time using the Quintus library. I think that the canvas mouse location should be stored along with the transformed mouse coordinates. This way we can get the current stage-world mouse coordinates by simply calling canvasToStageX and canvasToStageY when we need to.
Again, I may have missed something glaringly obvious.