• I want to extend the Graphics class and be able to use the same "method" names, but extend them. I'd like to do this by creating my own Graphics2 class that inherits from Graphics.

    Problem: How do I create a new Object derived from Graphics2 that's connected to the hardware display, like the built-in LCD object?

    This is the code I found in the source that I'm pretty sure is setting up the LCD var:

    void jswrap_graphics_init() {
    [#ifdef](http://forum.espruino.com/searc­h/?q=%23ifdef) USE_LCD_FSMC
      JsVar *parent = jspNewObject("LCD", "Graphics");
      if (parent) {
        JsVar *parentObj = jsvSkipName(parent);
        JsGraphics gfx;
        gfx.data.type = JSGRAPHICSTYPE_FSMC;
        gfx.graphicsVar = parentObj;
        gfx.data.width = 320;
        gfx.data.height = 240;
        gfx.data.bpp = 16;
        jsvUnLock2(parentObj, parent);

    Pretty straightforward -- if I was coding in C!

    Is there a way to accomplish the same thing in the Javascript interpreter with standard Espruino interfaces/classes, that would be great!


Avatar for dwallersv @dwallersv started