Running Processing 4 beta 7 on Windows 11. I am attempting to run a sketch that runs fine in Processing 3 on the same machine. Loading it now in P4 with no changes results in a “duplicate method settings()” error even though “settings()” only appears once in the main class for the sketch (and nowhere else). I use the settings() method to set the size of the window for the sketch based on a config file that gets loaded from the data folder for the sketch. This requires a call to loadJSONObject() from within settings(). Is it possible that the “duplicate method” error stems from that call in P4?
Hi @deisengard, I’m sorry no-one has replied. It would be easier if you posted the code. I suggest you save to a new name, and remove everything that isn’t part of the problem. see Minimum reproducible example.
Hello @deisengard ,
This works on W10 with Processing 4 beta 8:
// data.json file contents:
/*
{
"width": 100,
"height": 200,
}
*/
JSONObject json;
void settings()
{
json = loadJSONObject("data.json");
int w = json.getInt("width");
int h = json.getInt("height");
println(w, h);
size(w, h);
}
void setup()
{
println(width, height);
}
void draw()
{
background(0);
}
:)