line

yzheka-m/nokia-5510-display/line

No description
line
@/line
DISPLAY@/display
display object
START@/point
coordinate of the start of the line
END@/point
coordinate of the end of the line
BLACKboolean
Black or white color
line
DISPLAY
START
END
BLACK
DONE
DONEpulse
To use the node in your project you should have the yzheka-m/nokia-5510-display 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 {
    int x1,y1,x2,y2;
    bool black,set=false;
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto display = getValue<input_DISPLAY>(ctx);
    auto state=getState(ctx);
    if(state->set){
        display->drawLine(state->x1,state->y1,state->x2,state->y2,state->black?WHITE:BLACK);
    }
    auto start=getValue<input_START>(ctx);
    auto end=getValue<input_END>(ctx);
    state->x1=start->x; state->y1=start->y;
    state->x2=end->x; state->y2=end->y;
    state->black=getValue<input_BLACK>(ctx);
    state->set=true;
    display->drawLine(state->x1,state->y1,state->x2,state->y2,state->black?BLACK:WHITE);
    display->display();
    emitValue<output_DONE>(ctx, 1);
}