circle

yzheka-m/nokia-5510-display/circle

No description
circle
@/circle
DISPLAY@/display
display object
POSITION@/point
Position of the center on screen
RADIUSnumber
circle radius
FILLboolean
Fill circle or not
BLACKboolean
Black or white color
circle
DISPLAY
POSITION
RADIUS
FILL
BLACK
DONE
DONEpulse
Pulse when circle placed on the screen
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 x,y,radius;
    bool fill,black,set=false;
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    auto display = getValue<input_DISPLAY>(ctx);
    auto state = getState(ctx);
    if(state->set){
        if(state->fill)display->fillCircle(state->x,state->y,state->radius,state->black?WHITE:BLACK);
        else display->drawCircle(state->x,state->y,state->radius,state->black?WHITE:BLACK);
    }
    auto point = getValue<input_POSITION>(ctx);
    state->x=point->x; state->y=point->y;
    state->radius=getValue<input_RADIUS>(ctx);
    state->fill=getValue<input_FILL>(ctx);
    state->black=getValue<input_BLACK>(ctx);
    state->set=true;
    if(state->fill)display->fillCircle(state->x,state->y,state->radius,state->black?BLACK:WHITE);
    else display->drawCircle(state->x,state->y,state->radius,state->black?BLACK:WHITE);
    display->display();
    emitValue<output_DONE>(ctx, 1);
}