Skip to content

The size(); function being wierd #298

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

Closed
NickHoehnen opened this issue Aug 27, 2015 · 6 comments
Closed

The size(); function being wierd #298

NickHoehnen opened this issue Aug 27, 2015 · 6 comments

Comments

@NickHoehnen
Copy link

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"

@scotthmurray
Copy link
Member

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

@NickHoehnen
Copy link
Author

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

@scotthmurray
Copy link
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?

@brendanmatkin
Copy link

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() {

}

@REAS
Copy link
Member

REAS commented Sep 16, 2015

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

@REAS REAS closed this as completed Sep 16, 2015
L-four added a commit to L-four/evolutionSteer that referenced this issue Jun 20, 2017
…ocs#298 (comment) also added .gitattributes file to avoid eol style changes
L-four added a commit to L-four/evolutionSteer that referenced this issue Jun 21, 2017
…ocs#298 (comment) also added .gitattributes file to avoid eol style changes
L-four added a commit to L-four/evolutionSteer that referenced this issue Jun 21, 2017
…ocs#298 (comment) also added .gitattributes file to avoid eol style changes
@gmarxcc
Copy link

gmarxcc commented Dec 23, 2017

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

binitshah added a commit to binitshah/processing-android that referenced this issue Aug 6, 2024
As per processing/processing-docs#298 (comment), `size()` must be called within `settings` when using variables. This change was required to get the demo to run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants