I'm trying to make a game in Processing, however I don't want it to be in fixed coordinates. I'd like to make it the height of the screen and the width of the screen divided by 3.
I've tried screen.width
and screen.height
but they don't work.
Asked
Active
Viewed 4,511 times
1
-
1If you are referring to screen resolution, rather than window size this question should provide your answer. http://stackoverflow.com/questions/3680221/how-can-i-get-the-monitor-size-in-java – Robadob Oct 08 '15 at 10:37
3 Answers
3
You can use displayWidth
and displayHeight
they will be holding those data. Here their javaDoc:
http://processing.org/reference/javadoc/core/processing/core/PApplet.html#displayWidth
Also there is pixelDensity()
if you want to deal with retina display.
https://processing.org/reference/pixelDensity_.html
screen.width
and screen.Height
have been removed
https://github.com/processing/processing/wiki/Changes#user-content-changed-and-removed

v.k.
- 2,826
- 2
- 20
- 29
-1
Also if you want you could use the fullScreen() command then use this:
fullScreen();
if(mouseButton == LEFT){
println(mouseX + " : " + mouseY);
}
This will print the mouse coordinates when you left click. So click in the bottom right and it will display the X and Y coordinates. Then use a calculator to divide the y by 3.

zcmckenna
- 55
- 6