Visitar URL original
The size(); function being wierd · Issue #298 · processing/processing-docs · GitHub
Skip to content

The size(); function being wierd #298

Description

@NickHoehnen

I just upgraded my processing to the latest version(3.0b5), and when I try to run a sketch that used to work, I get an error message:
"size() cannot be used here, see https://processing.org/reference/size_.html"

The example in the link shows the size() in the setup(), like what I have.

Here is my setup() code:
void setup()
{
size(1000, 800);
background(200, 200, 200);
frameRate(60);
}
I tried to use fullScreen() instead of size, but it also said that it "cannot be used here"

Activity

  1. scotthmurray commented on Aug 27, 2015

    @scotthmurray
    Member

    What happens if you remove all of the contents within draw()? I suspect the issue is later in your code.

  2. NickHoehnen commented on Aug 28, 2015

    @NickHoehnen
    Author

    If I remove everything from draw(), the same error occurs.

  3. scotthmurray commented on Aug 28, 2015

    @scotthmurray
    Member

    So, to confirm, you see this error if you run this code?

    void setup() {
      size(1000, 800);
      background(200, 200, 200);
      frameRate(60);
    }
    
    void draw() {
    }
    

    This is on 3.0b5. What OS?

  4. brendanmatkin commented on Sep 14, 2015

    @brendanmatkin

    In some cases, size must be called in 'settings()' https://processing.org/reference/settings_.html

    Settings is used for size whenever you are using variables in size() (which you shouldn't anyway) and when you are using another IDE. I THINK this could also be related to a bug regarding size parameters that are larger than the screen size? processing/processing#3401

    void settings() {
      size(1000, 800);
    }
    
    void setup() {
      background(200);
    }
    
    void draw() {
    
    }
    
  5. REAS commented on Sep 16, 2015

    @REAS
    Member

    This isn't a "processing-docs" issue, so I am closing it out here. @nick13579, please move this to the forum: http://forum.processing.org

  6. gmarxcc commented on Dec 23, 2017

    @gmarxcc

    The settings( ) option was the best way to solve the problem, thanks.

  7. added a commit that references this issue on Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions