I'm reading through the C API documentation and I see that there exists a command for setting a clipping rectangle:
pd->graphics->setClipRect();
"Sets the current clip rect, using world coordinates—that is, the given rectangle will be translated by the current drawing offset. The clip rect is cleared at the beginning of each update."
However, I can't seem to get it to work. I have been tinkering with the Hello World example program, with my main goal being only updating the parts of the screen strictly necessary for drawing the moving text. I can accomplish this with a filled rectangle:
int clearRectPadding = 2;
pd->graphics->fillRect(x - clearRectPadding, y - clearRectPadding, TEXT_WIDTH + clearRectPadding * 2, TEXT_HEIGHT + clearRectPadding * 2, kColorWhite);
However, I have not been able to get this to work with the setClippingRect
function. Can someone point me to a C example where someone has gotten this to work for them?