createSDL on Linux

Posted on
  • 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);
    g.drawString("SpaceWeaver", 85,35);

    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­b/master/boards/ 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.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

createSDL on Linux

Posted by Avatar for user156311 @user156311