Most of the time you don't need settings. The main reason I find using settings is if I want to initialize a sketch based on the same of an image. Something like this:
There are some other situations you might need to use settings (GH Wiki reports settings() to be explicitly implemented when using Eclipse and the ADT plugin). I would say you are safe omitting settings().
The settings() function is new with Processing 3.0. It's not needed in most sketches. It's only useful when it's absolutely necessary to define the parameters to size() with a variable. Alternately, the settings() function is necessary when using Processing code outside of the Processing Development Environment (PDE). For example, when using the Eclipse code editor, it's necessary to use settings() to define the size() and smooth() values for a sketch..
The settings() method runs before the sketch has been set up, so other Processing functions cannot be used at that point. For instance, do not use loadImage() inside settings(). The settings() method runs "passively" to set a few variables, compared to the setup() command that call commands in the Processing API.
Settings is rarely used. One of the most common use cases for settings() is, as @kfrajer mentions, to establish dynamic width and height parameters for size(). If you try to do this in setup() you get an error.
Answers
***EDITED
Most of the time you don't need settings. The main reason I find using settings is if I want to initialize a sketch based on the same of an image. Something like this:
There are some other situations you might need to use settings (GH Wiki reports
settings()
to be explicitly implemented when using Eclipse and the ADT plugin). I would say you are safe omittingsettings()
.Kf
From the current reference:
Settings is rarely used. One of the most common use cases for
settings()
is, as @kfrajer mentions, to establish dynamicwidth
andheight
parameters forsize()
. If you try to do this insetup()
you get an error.