quinton-ashley / p5play

JavaScript game engine that uses q5.js/p5.js for graphics and Box2D for physics.
https://p5play.org
GNU Affero General Public License v3.0
667 stars 184 forks source link

Does p5play impact the p5 DOM functions? #281

Closed zoebachman closed 11 months ago

zoebachman commented 11 months ago

Hello - not sure if this is an issue with the p5.js web editor or something changed in this library, but one of my student's p5play projects suddenly stopped working today and it seems like the error is introduced once we link the p5play library. She built it in the p5 web editor (here's my copy of her code).

She's trying to position her canvas within a larger webpage, but when she calls .position on her canvas element, she now gets an error saying that .position is not a recognized function (here it is in the p5 documentation). I was stumped because all of this code was working fine for the past several days until today when she went to present it in class. I tried the .position sample code in a new project and it works fine - until I include the p5play libraries. I know that in the past you have to separately include the p5 DOM library, but my understanding is that it's no longer the case? I tried it in OpenProcessing and running into the same error. Thanks!

GoToLoop commented 11 months ago

Indeed, if p5.play is loaded, createCanvas() returns the <canvas> element itself! However, it should return a p5.Renderer object instead.

quinton-ashley commented 11 months ago

Ah yes my mistake. Thanks for reporting! Fixed in v3.18.8