Does anyone have hints for using espruino on Linux?
I can get it to create a window and draw into it
g = Graphics.createSDL(1024, 768, 8);
but then application exits, so text is only visible for millisecond or so. Does anyone have example of using createSDL? Ideally I'd like to handle input events, too, but Bangle.on() does not seem to be available on Linux.
Hi - sorry for the delay. If you want to make it hang around you can just do setInterval("", 1000) - as long as there is something to execute it'll stay running.
But I'm afraid there's no input event handling - honestly the Linux build is there mainly for testing, so sometimes I use SDL to display the result of doing something on Graphics, but I don't do anything two-way. Normally I just use createArrayBuffer and dump the output to a file with g.asBMP().
I guess if you wanted to actually develop Bangle.js apps you could build for the https://github.com/espruino/Espruino/blob/master/boards/BANGLEJS2_LINUX.py board - but that doesn't use SDL - adding it for IO would be a reasonable undertaking.
... having said that I believe someone did make an app that used the WASM-compiled Bangle.js emulator that the IDE uses, and made it into a Rust (I think?) CLI app.
Thanks for setInterval() hint. I have done some hacks, and input event handling does not look that hard.
Note in createSDL documentation that corresponding input does not exist would be welcome; it is not obvious from documentation and it took me a while to figure out.
If you have pointer to that CLI app, that would be nice. Quick search did not find anything.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem