Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong width and height during setup() #68

Closed
jonathanperret opened this issue Sep 22, 2017 · 0 comments
Closed

Wrong width and height during setup() #68

jonathanperret opened this issue Sep 22, 2017 · 0 comments
Labels

Comments

@jonathanperret
Copy link
Owner

jonathanperret commented Sep 22, 2017

Given a sketch like this:

float center;
void setup() {
  center = width / 2;
}
void draw() {
  rect(center - 5, 0, 10, 10);
}

One would expect something to appear at the center top of the canvas, but instead it happens somewhere in the top left. This is because width and height have their default value of 150 during the execution of setup(), and Paysage’s auto-sizing to the window only happens between setup() and draw().

etienneCharignon added a commit that referenced this issue Sep 22, 2017
Without this, the code in setup() ran with the default canvas size of 150x150,
causing sketches that captured width and height in setup() to be confined to
the top left of the screen.

Fixes #68.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant