Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

registerMethod implementation needed for p5play compatibility! #20

Open
quinton-ashley opened this issue Feb 6, 2023 · 7 comments
Open

Comments

@quinton-ashley
Copy link

Hi I think this library is really great but I noticed there's no registerMethod implementation. Lots of p5 libraries rely on this feature, including mine, p5.play!

I think making q5 compatible with p5.play would be perfect because my library only needs the 2D p5 functions. p5js is bloated and I think my users would especially benefit from q5 on mobile.

Let me know if you're currently working on a registerMethod implementation. If not I will try doing it.

@quinton-ashley
Copy link
Author

I also noticed the q5xjs npm package is outdated. I would really need it to be kept up to date. If you're busy with other projects and aren't interested in maintaining q5xjs anymore, I'd like to submit my candidacy to maintain it for you! You can see how much work I've put into p5.play on my website and I'd be a big advocate for q5.

https://p5play.org

@quinton-ashley
Copy link
Author

I would also need anything added by p5.js addon libraries to exist in the global scope or in q5 instances, not (only) in a separate windows.addons object.

@quinton-ashley quinton-ashley changed the title registerMethod implementation? registerMethod implementation needed for p5.play compatibility! Feb 6, 2023
@quinton-ashley
Copy link
Author

btw I really like your code style! Short and concise. I'm gonna go ahead and try making all the necessary improvements to q5xjs so that it can work with p5.play. If you like what I end up with you can add me as a contributor to this project, otherwise I will make my own repo for it.

@quinton-ashley
Copy link
Author

quinton-ashley commented Feb 8, 2023

Here's my progress so far, I've made a lot of big upgrades!

https://github.com/quinton-ashley/q5.js

@quinton-ashley
Copy link
Author

I added automatic global instance creation to q5.js so p5.js sketches could be fully compatible with q5.js without the user needing new Q5('global'); at the beginning of their sketch. The neat part is I managed to figure out how to also keep your functionality of a user initiated start to the global q5 instance so users can still use q5 functions outside of the setup function!

I did it by adding a variable to check if a global instance of Q5 has been created yet.

function Q5(scope) {
	if (scope == 'global') Q5._global = true;

I put the following code at the end of the q5js file. It creates a new global Q5 instance after all scripts are loaded, if one hasn't been created by the user already.

document.addEventListener('DOMContentLoaded', () => {
	if (!Q5._global) new Q5('global');
});

I'll make a pull request with my changes soon. :)

@quinton-ashley
Copy link
Author

quinton-ashley commented Feb 13, 2023

Check out my list of what's new in version 1.0 😄

https://github.com/quinton-ashley/q5.js#whats-new-in-version-10

@quinton-ashley
Copy link
Author

There's a bug with sprite.rotateTo in p5play when using q5 that I'm gonna try to solve. After that I'll submit a pull request.

@quinton-ashley quinton-ashley changed the title registerMethod implementation needed for p5.play compatibility! registerMethod implementation needed for p5play compatibility! Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant