<p>I´m new to the Processing language. Trying to do my first sketch I´m having trouble with the dimension of the display window width and height because even though I´ve tried putting a variety of values in the size() function, the size of the window doesn´t change at any time, it always has the same size (100px x 100px). The function fullScreen() has the same results. How could I resolve this problem?</p>

<p>It´s a simple visualization of a "star field". First block, class Star, simply create a star and fill it with a color. Second block is where I´m trying to adjust the size of the display window but it doesn´t work.</p>



<pre class="lang-processing prettyprint-override"><code>class Star {
  float x;
  float y;
  float z;

  Star(){
    // Places the star in random X and Y coordinates
    x = random(0, width);
    y = random(0, height);
  }

  /* Colors the star */
  void update(){
    fill(255);
    noStroke();
    ellipse(x, y, 8, 8);
  }

  void show(){}
  }
</code></pre>

<hr>

<pre class="lang-processing prettyprint-override"><code>// Array that contains all the amount of stars created (100 in this case)
Star[] stars = new Star[100];

void Setup(){
  size(800, 800); // TROUBLE HERE. DOESN´T WORK
  for(int i = 0; i &lt; stars.length; i++){
    stars[i] = new Star();
  }
}

void Draw(){
  background(0); // Colors the background
  for(int i = 0; i &lt; stars.length; i++){
    stars[i].update();
    stars[i].show();
  }
}
</code></pre>

<processing>
Issue with size() function in Processing language?
chick3n0x07CC
# Issue with size() function in Processing language?

(Asked by: username_0 on 2016-06-27)

I´m new to the Processing language. Trying to do my first sketch I´m having trouble with the dimension of the display window width and height because even though I´ve tried putting a variety of values in the size() function, the size of the window doesn´t change at any time, it always has the same size (100px x 100px). The function fullScreen() has the same results. How could I resolve this problem?
It´s a simple visualization of a "star field". First block, class Star, simply create a star and fill it with a color. Second block is where I´m trying to adjust the size of the display window but it doesn´t work.
class Star {
  float x;
  float y;
  float z;

  Star(){
    // Places the star in random X and Y coordinates
    x = random(0, width);
    y = random(0, height);
  }

  /* Colors the star */
  void update(){
    fill(255);
    noStroke();
    ellipse(x, y, 8, 8);
  }

  void show(){}
  }


// Array that contains all the amount of stars created (100 in this case)
Star[] stars = new Star[100];

void Setup(){
  size(800, 800); // TROUBLE HERE. DOESN´T WORK
  for(int i = 0; i < stars.length; i++){
    stars[i] = new Star();
  }
}

void Draw(){
  background(0); // Colors the background
  for(int i = 0; i < stars.length; i++){
    stars[i].update();
    stars[i].show();
  }
}

**Tags:** processing

---

## 0 answers

