Created
November 27, 2011 21:23
-
-
Save bmander/1398173 to your computer and use it in GitHub Desktop.
how to center the screen, in processing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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