Daily Entry: June 13th, 2017

Tue Jun 13 05:02:50 UTC 2017

I have a proof-of-concept of making pygame code run in browser.

You may notice that things aren't lined up correctly. Certain things get lost in translation using pyjs. Namely, getters and setters.

It looks like Transcrypt does a better job of that, but after fiddling with pyjsdl, it looks like the pyjs compilable pygame rewrite seriously uses the pyjs library. Not so simple to replace pyjs code with transcrypt code.

However, there is a port of pygame written directly to javascript called game.js. The API looks fairly identical except functions look like "setMode" instead of "set_mode".

It's possible to import javascript libraries in Transcrypt. It may be possible to use game.js with Transcypt to port pygame code to javascript.

That's what I'll explore today.

Tue Jun 13 11:44:14 UTC 2017

Transcrypt and game.js together is a plausible route. However, it'd be a lot of work and how good the final product would look/feel is unknown. The API between game.js and pygame is different enough to make even hello world complicated to recreate. Missing is an ellipsis draw method. The size of the screen is also supposed to be dictacted by CSS (as it is in that link just given).