You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • The train time page looks really neat... Is it actually for someone, or is it just a personal project?

    Yes, Espruino could do the animation just fine and push the pixels - but the graphics library doesn't have the same API as Canvas (on quite a constrained device, the whole stroke/fill stuff doesn't really make that much sense).

    There's support for custom fonts - see here. You'd just have to put your font into the required format, which shouldn't take long at all. Then it's just a matter of using g.drawString and g.stringWidth, so it should be nice and easy.

    The only thing I'd say is to queue the HTTP request after the 'train stops at' has gone offscreen. That way if there's a delay it won't be visible to the user (unfortunately when looking up a domain name, Espruino usually has to block while it's resolved).

    If you want to use C, the easiest way is to just get Espruino's source code and then add your own source file, which can provide objects + functions that JavaScript can then use. You can compile C code on your PC and then dynamically load the compiled code into memory and register it as a function using E.nativeCall, but I haven't come up with any scripts to do that, so it's not going to be much fun.

    I doubt you'd need to do any of that though. Worst case is you have to do some fiddling around with the data from the graphics library to get it into a format that'll work with your display, but I think that'd be pretty easy to do quickly.


Avatar for Gordon @Gordon started