tftinitbutton

ivanmason/tft-lcd-touch/tftinitbutton

No description
tftinitbutton
@/tftinitbutton
TFT@/tftlcd-device
DEV@/tftbutton-device
STXnumber
Start X Top Left Corner
STYnumber
Start Y Top Left Corner
WXnumber
Width
HYnumber
Height
OCOLnumber
Outline Colour
FCOLnumber
Fill Colour
TCOLnumber
Text Colour
TXTstring
Text
TSIZEnumber
Text Size
UPDpulse
tftinitbutton
TFT
DEV
STX
STY
WX
HY
OCOL
FCOL
TCOL
TXT
TSIZE
UPD
DONE
DONEpulse
To use the node in your project you should have the ivanmason/tft-lcd-touch 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
     if (!isInputDirty<input_UPD>(ctx))
        return;
   
    auto tft = getValue<input_TFT>(ctx);
    auto button = getValue<input_DEV>(ctx);
    int16_t x1 = getValue<input_STX>(ctx);
    int16_t y1 = getValue<input_STY>(ctx);
    uint16_t w = getValue<input_WX>(ctx);
    uint16_t h = getValue<input_HY>(ctx);
    uint16_t outline = getValue<input_OCOL>(ctx);
    uint16_t fill = getValue<input_FCOL>(ctx);
    uint16_t textcolor = getValue<input_TCOL>(ctx);
    auto text = getValue<input_TXT>(ctx);
    uint8_t textsize = getValue<input_TSIZE>(ctx);

     // `length` returns the number of characters and you need an extra one to keep the
    // terminal NUL-character used in C string representation. Initialize to 0’s to ensure the last char is indeed NUL
    char label[length(text) + 1] = { 0 };
    // move the data from XString to the plain C string
    dump(text, label);

    button->initButtonUL(tft, x1, y1, w, h, outline, fill, textcolor, label, textsize);
    button->drawButton();
    emitValue<output_DONE>(ctx, 1);
}