Skip to content

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

Closed
@processing-bot

Description

@processing-bot

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions