Questions about ofBeginSaveScreenAsPDF


#1

I do not really understand the syntax about this function.

  1. what is the ‘oneShot’ means in the if condition (it does not look like a condition statement I have seen before)

  2. what is the ‘false’ means at the bottom?


#2

The oneShot variable is keeping track of when the next frame should be rendered to a PDF. When a key is pressed the oneShot variable is set to true (this is not shown in your code). Then the next time a new frame is drawn, then the sequence below takes place.

It might be better to write it as:

if (captureTheNextFrameAsAPDF == true)
{
 ofBeginSaveScreenAsPDF(...);
}


// draw the things that will be captured to the pdf

if (captureTheNextFrameAsAPDF == true)
{
   ofEndScreenSaveAsPDF();
   captureTheNextFrameAsAPDF = false; // Now don't capture the next one, until the button is pressed again.
}