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

size(863,863/2) not working as first line of setup() function in a simple sketch #602

Closed
jedishrfu opened this issue Nov 19, 2022 · 4 comments · Fixed by #609
Closed

size(863,863/2) not working as first line of setup() function in a simple sketch #602

jedishrfu opened this issue Nov 19, 2022 · 4 comments · Fixed by #609

Comments

@jedishrfu
Copy link

When running one of Dan Shiffman's examples, it failed on the size(863,863/2); line in the setup(). The error said to look at the documentation for the size() function. The only requirement was for the size() function to be in the setup() function as the first line and for it to be in the processing sketch named the same.

However, it appears the size() can't have arithmetic expressions as part of the argument list.

Description

When running one of Dan Shiffman's mandelbrot example sketch, it failed on the size(863,863/2); statement in the setup() function. The error said to look at the documentation for the size() function.

The documentation for size():

  • size() function must be in the setup() function as the first line
  • and for size() to be in the main processing sketch.

However, it appears the size() can't have arithmetic expressions as part of the argument list.

Expected Behavior

expected the size(863,863/2); to work or with integer variables as arguments

Current Behavior

sketch won't run, error messages says size() can't be used here, changing it to size(863,431); got it to work.

Steps to Reproduce

  1. include a size(863,863/2) as the first statement in the setup() function of a simple sketch
void setup() {
    size(863,863/2);
}
void draw() {

}
  1. run program
  2. should see error below sketch code

Your Environment

  • Processing version: 4.0.1
  • Operating System and OS version: MacOS 10.13 Ventura
  • Other information: Running on a macmini with Apple M1 chip

Possible Causes / Solutions

workaround is to do the sizing math and keep size(863,431); arguments as simple integer constants.

provide a better error message that points to the arguments as not being simple integers.

@benfry
Copy link
Owner

benfry commented Nov 23, 2022

@sampottinger this would be a preproc issue… the reference should say that you should only use numbers there (it says not to use variables, but I didn't think of writing equations as a way to break it…) but we should be able to allow this.

@sampottinger
Copy link
Collaborator

sampottinger commented Nov 24, 2022 via email

@sampottinger
Copy link
Collaborator

sampottinger commented Nov 26, 2022 via email

@github-actions
Copy link

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants