wt-sprite

wayland/wio-terminal-lcd/wt-sprite

Create a sprite. A sprite is stored in RAM and can be rendered to the LCD using either push-sprite or push-rotated-sprite.
wt-sprite
@/wt-sprite
Create a sprite. A sprite is stored in RAM and can be rendered to the LCD using either push-sprite or push-rotated-sprite.
DEV@/wt-lcd-device
A wt-lcd-device.
Widthnumber
Width of sprite in pixels.
Heightnumber
Height of sprite in pixels.
wt-sprite
Sprite
DEV
Width
Height
Sprite@/wt-sprite
A wt-sprite object.
To use the node in your project you should have the wayland/wio-terminal-lcd library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

node {

    meta {
        // Define our custom type as a pointer on the class instance.
        using Type = TFT_eSprite*;
    }

    uint8_t mem[sizeof(TFT_eSprite)];

    void evaluate(Context ctx) {
        // It should be evaluated only once on the first (setup) transaction
        if (!isSettingUp())
            return;

        auto tft = getValue<input_DEV>(ctx);

        Type spr = new (mem) TFT_eSprite(tft);

        // initialize sprite
        spr -> setColorDepth(16);
        spr -> createSprite(getValue<input_Width>(ctx), getValue<input_Height>(ctx));

        emitValue<output_Sprite>(ctx, spr);
    }
}