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
processing-bot opened this issue Nov 19, 2022 · 4 comments

Comments

@processing-bot
Copy link
Collaborator

Created by: jedishrfu

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.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

@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.

@processing-bot
Copy link
Collaborator Author

Created by: sampottinger

Sorry about that. I’ll add a test and resolve.

@processing-bot
Copy link
Collaborator Author

Created by: sampottinger

Should have some time tomorrow to work on processing stuff. Will prioritize this. Thanks!

@processing-bot
Copy link
Collaborator Author

Created by: github-actions[bot]

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 Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant