displayWidth ,displayHeight calculator

edited November 2013 in Share Your Work

sorry for my english. if you use "displayWidth, displayHeight", inserting the code in your sketch, helping you find the right position to insert your drawings

PFont work;
    void setup() {
      size (displayWidth, displayHeight);
      orientation (LANDSCAPE);

      work = createFont ("Arial",32);
    }
    void draw() {

      pushMatrix();
      background (0, 255);
      textFont (work, width/30);
      fill (255, 0, 0); 

      float x = (width*1000 )/( mouseX+1);
      x = x/1000;
      float y = (height*1000 )/( mouseY+1);
      y = y/1000;

      String xx  = nf (x, 1, 3);
      String yy  = nf (y, 1, 3);

      text ("W /", mouseX/1.13, mouseY/1.13 + height/20);
      text (xx, mouseX/1.13 + width/20, mouseY/1.13 + height/20);
      text ("H /", mouseX/1.13, mouseY/1.13 + height/10);
      text (yy, mouseX/1.13 + width/20, mouseY/1.13 + height/10);
      popMatrix();
    }
Sign In or Register to comment.