Processing – Present Mode Background Color

How to change the background color while running in Present Mode?

Add to setup() (NOTE: doesn’t work for Processing 3+!)

((javax.swing.JFrame) frame).getContentPane().setBackground(new java.awt.Color(0, 0, 0));

Alternative method (also Processing 3+!):

  • close Processing!
  • edit <user name>/Appdata/Roaming/Processing/preference.txt
  • make sure the run.present.bgcolor line looks like this:
    run.present.bgcolor=#000000

Processing – How to detect Present Mode

How to detect if a sketch is running in the Present Mode or not?

// TRUE IF IN PRESENT MODE
boolean FULL_SCREEN = frame.isUndecorated();

if (FULL_SCREEN)
{  // WE ARE IN PRESENT MODE
   size(displayWidth, displayHeight, P2D);
   [... do stuff ...]
} else
{  // WE ARE IN NORMAL MODE
   size(800, 600, P2D);
   [... do other stuff ...]
}

 


Processing – Starting a sketch in full screen mode

This is how you can start a Processing sketch in full screen mode (without using SHIFT-CTRL-R). Include the function sketchFullScreen():

static final boolean FULL_SCREEN = true;

/*********************************************************************
 * 
 *   START THE SKETCH IN PRESENT MODE (if FULL_SCREEN == true)
 * 
 *********************************************************************/
boolean sketchFullScreen()
{
  return FULL_SCREEN;
} // sketchFullScreen()