ardean / jsGBC-core

jsGBC Core Emulator
https://github.com/ardean/jsGBC/
MIT License
15 stars 2 forks source link

Port to Node.js #2

Open piranna opened 7 years ago

piranna commented 7 years ago

Now that node-canvas has backends support and would allow to print directly to the screen, it would be nice to have a port of this using a node-canvas instance instead of an HTML5 canvas one (the APIs are the same in purposse) to have this working on NodeOS :-)

ardean commented 7 years ago

Wow, cool idea! I'll look at it today after work.

ardean commented 7 years ago

I refactored some browser specific code and now we can start jsgbc-core in the node environment. But there will be more work for sound support, because of the use of the webaudio AudioContext. (Audio should be disabled for now with nodejs) The controls are an other missing feature in nodejs, but should not be a huge problem.

I think a jsgbc-node package including a cli would be an appropriate solution for NodeOS.

You can checkout the new branch v0.5.0 on this repo which includes the recent changes. There is a little sample script using nodejs.

piranna commented 7 years ago

I refactored some browser specific code and now we can start jsgbc-core in the node environment. But there will be more work for sound support, because of the use of the webaudio AudioContext. (Audio should be disabled for now with nodejs) The controls are an other missing feature in nodejs, but should not be a huge problem.

Npm has modules for everything :-) There are modules that provides AudioContext API on top of ALSA (but NodeOS don't support it yet, but should be easy), and the same for the controls, there are modules for keyboard low level access and for Gamepad API :-) The trick would be to give an interface-agnostic core (or maybe using W3C standards) and later do specific wrappers for each environment.

I think a jsgbc-node package including a cli would be an appropriate solution for nodeos.

Yes, that would be a great design :-D