Skip to content

Instantly share code, notes, and snippets.

@bmander
Created November 27, 2011 21:23
Show Gist options
  • Save bmander/1398173 to your computer and use it in GitHub Desktop.
Save bmander/1398173 to your computer and use it in GitHub Desktop.
how to center the screen, in processing
// how to center the screen in processing. I have the hardest time remembering, much less intuiting, this:
size( 200, 200 );
int l = 0;
int b = 70;
int r = 500;
int t = 700;
float xres = width/float(r-l);
float yres = height/float(t-b);
scale( xres, -yres );
translate( -l, -t );
line( l, b, r, t );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment