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.
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
您可以使用Toolkit.getScreenSize()方法获取屏幕尺寸。
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.