We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi All
I am working on a surface.setSize with multiple sizes. Now i know how to do that. Inside the 'surface.setSize', i wanne use a 2dimensional array, but that doesnt work. I don't know why.
int cols = 400; int rows = 500;
int[][] size = new int[cols][rows];
void setup() { size(100, 100); surface.setResizable(true); }
void draw() { background(2); if (key == '1') { surface.setSize(size[][]) ; } else if (key == '2') { surface.setSize(size[][]) ; } }
Can anyone tell me the problem.
Tnanks@!
Answers
Not sure why you are using a 2D array. Try this next code.
Kf
Thank you for your comment. I excually already knew how to do this. I was just wondering if i could make a 2D array of two values for inside a setSize
You variable size has 400 cols and 500 rows, for a total of 400*500 elements @-)
Kf
@jaspervanblokland --
You are saying "a 2D array" but do you actually mean an object that contains a pair of variables -- like a PVector can be used to express an x and a y?
https://processing.org/reference/PVector.html
...and then you would want an array of PVectors (
PVector[] mysizes
) to contain multiple screen sizes...?Yes, that is what i meant! Thank you!