1

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Tvde1
  • 1,246
  • 3
  • 21
  • 41
  • 1
    If 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 Answers3

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

You can obtain your screen size by using Toolkit.getScreenSize() method.

Volken
  • 255
  • 1
  • 4
  • 23
-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