ByronHsu

How to resize windows anytime and access mouse position directly in pixi.js?

Recommended Posts

1.  How to resize the window at any time when I change my window size. Something weird will occur in my app now like the image below.(the right size should be black)

2. How can I directly access mouse local position without listening to an event. I want to deliver my mouse local position to the server even if the mouse doesn't move at all.

Thx a lot!!

Screen Shot 2017-12-10 at 1.06.00 AM.png

Screen Shot 2017-12-10 at 1.06.03 AM.png

Share this post


Link to post
Share on other sites

Its html thingy, "window.onresize = ..." . Please search forums for code, any "resize" in this pixi subforum , like this thread: 

 , just add "window.onresize=coolResize" instead of putting it in app.ticker and it'll be fine. However you can just take that code and use, it will also work.

Share this post


Link to post
Share on other sites

'app.renderer.plugins.interaction.mouse.global`  . Interaction here is instance of https://github.com/pixijs/pixi.js/blob/dev/src/interaction/InteractionManager.js that is created for every renderer. I hope that'll be changed in v5, because mouse coords after 5 dots is a strange thing.

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.