JeZxLee Posted July 17, 2017 Share Posted July 17, 2017 Hi, Looking at the documents, in "InteractionManager" pages. I can't seem to find house to get mouse screen x, y ? If I just use mouse functions would that support basic touch input on mobile? Thanks! JeZxLee Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 17, 2017 Share Posted July 17, 2017 "renderer.plugins.interaction.mouse.global" As for pointers, you have to get coords from events data. "pointerdown" and those kind of events are working on mobile. And seriously, creating new topic when you have one for interaction already is bad. Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted July 17, 2017 Author Share Posted July 17, 2017 Sorry for the new post, tired... I am completely lost with getting mouse/touch coordinates. Need something simple for now that supports both computers and mobile. (multi-touch will be added at a much later date) Can you just write a small example which puts the (x, y) of mouse/touch in the following global variables?: var MouseX = 0; var MouseY = 0; var MouseButtonClicked = false; var MouseButtonDown = false; JeZxLee Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 17, 2017 Share Posted July 17, 2017 5 minutes ago, JeZxLee said: Sorry for the new post, tired... I am completely lost with getting mouse/touch coordinates. Need something simple for now that supports both computers and mobile. (multi-touch will be added at a much later date) Can you just write a small example which puts the (x, y) of mouse/touch in the following global variables?: var MouseX = 0; var MouseY = 0; var MouseButtonClicked = false; var MouseButtonDown = false; JeZxLee Just go sleep ^_^. Coords are in "renderer.plugins.interaction.mouse.global", and if you want multitouch, you have to handle it per event, it cant be done with global vars. Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted July 17, 2017 Author Share Posted July 17, 2017 Hi, I got mouse coordinates working on computers, but get nothing on Google mobile? You can run the demo HERE. You can download the current source code HERE. Thanks! JeZxLee Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted July 18, 2017 Author Share Posted July 18, 2017 Hi, I have the following code: function GetMouseTouchScreenXY() { var mouse = renderer.plugins.interaction.mouse.global; MouseX = mouse.x; MouseY = mouse.y; if (mouse.mousedown) MouseButtonDown = true; else if (MouseButtonDown == true) { MouseButtonDown = false; MouseButtonClicked = true; } else { MouseButtonDown = false; MouseButtonClicked = false; } } The mouse coordinates work on computers but not Android? Also the clicking on left mouse button is not working? What am I doing wrong, the documentation on mouse input is confusing... JeZxLee Quote Link to comment Share on other sites More sharing options...
themoonrat Posted July 18, 2017 Share Posted July 18, 2017 Take a look at the examples page which demonstrates usage https://pixijs.github.io/examples/#/demos/interactivity.js Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted July 18, 2017 Author Share Posted July 18, 2017 Ok, that explains alot... How would I just get a mouse click anywhere on the game's canvas? JeZxLee Quote Link to comment Share on other sites More sharing options...
themoonrat Posted July 18, 2017 Share Posted July 18, 2017 renderer.plugins.interaction.on( 'pointerdown', ( event ) => { console.log( event ) } ); Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted July 18, 2017 Author Share Posted July 18, 2017 That works, thanks... Still no touch coordinates on my Android devices? (no x,y - but touch is detected) Do I have to do something special to get the above? JeZxLee Quote Link to comment Share on other sites More sharing options...
themoonrat Posted July 19, 2017 Share Posted July 19, 2017 Use a breakpoint and look within the event object after adding a pointermove event renderer.plugins.interaction.on( 'pointermove', ( event ) => { console.log( event ) } ); All the info you need is in there Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted July 19, 2017 Author Share Posted July 19, 2017 i don't need mouse coordinates anymore... Please help with this issue: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.