Created
April 1, 2018 11:08
-
-
Save hiroto3432/a2b2e67445f802386a4dc0d1357d7363 to your computer and use it in GitHub Desktop.
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
void setup(){ | |
size(500,500); | |
surface.setResizable(true); | |
//PSurface psf = getSurface(); | |
//psf.setResizable(true); | |
frameRate(30); | |
textAlign(CENTER,CENTER); | |
} | |
int PWidth = 500; | |
int PHeight = 500; | |
float ScaleW = 1.0; | |
float ScaleH = 1.0; | |
void draw() throws IllegalArgumentException{ | |
if(PWidth != width || PHeight!=height){ | |
ScaleW *= (float)width / PWidth; | |
ScaleH *= (float)height / PHeight; | |
PWidth = width; | |
PHeight = height; | |
} | |
println(ScaleW,ScaleH); | |
scale(ScaleW,ScaleH); | |
background(0); | |
noStroke(); | |
fill(0,255,0); | |
ellipse(100,100,200,200); | |
fill(255,255,0); | |
rect(200,200,300,300); | |
fill(255); | |
textSize(48); | |
text("W:" + PWidth,350,100); | |
text("H:" + PHeight,100,350); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment