I need to use the get() function for one of my algorithms, but rather than the get (x,y,width,hight) -
gets a rectangle - is there any way to use the get with an ellipse?
Before I place my unorganized code in here, I have a question:
In my program I'm loading text from a file 'xyz'. This file has a strucutre as follows:
value 1; value 2; value 3; value 4; string 1;
value 1; value 2; value 3; value 4; string 1;
value 1; value 2; value 3; value 4; string 2;
value 1; value 2; value 3; value 4; string 2;
value 1; value 2; value 3; value 4; string 1;
It's a file with approxamitely 2000 lines, with several values (separated by ';') and finishing with one of several strings. The values also differ because they represent coordinates.
I've been able to load into an array all of these values and divide them at the semi-colon.
String[] stringA= loadStrings("actions.csv");
for (int i = 0; i < stringA.length; i++) {
String[] stringB = split(stringA[i], ';');
}
What I need is to isolate onto separate arrays the lines where the strings are similar. That is, put into an array X all the lines that have 'string1' (and corresponding values) and into an array Y all lines that have 'string2' and so forth.
I need this because I have several buttons (one for each type of string) and I want each button to control the appearance of independent values stored in string X, Y and so forth.
I've built in a scrollbar (used an example from Reas & Fry's book) so that I can control the appearance of objects.
Basically, as the value of the scrollbar increases, the number of objects being shown also increases (the position of the objects are being retrieved from a text file and placed in an array).
What I need is that, when the scrollbar value decreases, all the objects that were previously drawn but do not corresponde to the scrollbar's actual value be removed. What happens now is that the objects are still drawn, but in reverse order.
Am I making any sense? Here's what I got:
String[] posicoes = loadStrings("posicoes.csv");
float posactual=(posicoes.length*pos1)/100; // value of scroll is equivalent to a value in the array println(posactual);
for (int i = 0; i < posactual ; i+=amosP) { String[] pieces = split(posicoes[i], ';'); int x = int((float(pieces[posX_Pos]))/racioMapa); int y = 1000/int(racioMapa)-(int(float(pieces[posY_Pos])/racioMapa)); int z = int(pieces[jogPos]);
switch(z) { case 1: fill (0, 0, 255); //BLUE strokeWeight(0.5); circulo = new Circulo (x, y, ellip_w, ellip_h); circulo.display(); break; case 2: fill (0, 255, 0); //GREEN strokeWeight(1); circulo = new Circulo (x, y, ellip_w, ellip_h); circulo.display(); break; } }
Some of the info related to the object creation and others is missing, but I'll fill in the rest if necessary :)
I'm really sorry to bring up such an - what I suppose - easy question, but I'm getting this error constantly, despite moving around files within my sketch folder.
Question: what is the standard procedure for installing a library and all its components within a sketch folder.
I grasp the code, but the actual moving of files withing folders is generating some unexpected errors.
I've downloaded a couple of libraries. I've extracted them. I've created a 'libraries' folder in the root of my sketch folder as indicated by Processing. I've copied the 'xpto'.jar in the 'origintal' library folder to the 'libraries' folder. Now what?
Where should the remaining folders be placed? In the root of the sketch folder? Within the libraries folder? Should the files be kept in their original extracted foder?
Thanks for the time and once again, sorry for the 'easy' question :)
Hi all;
Programming newbie here. I'm developing a couple of things with processing but my programming skills are pretty rusty.
Anyway, my programming question is as follows.
I want to draw a grid formed by rectangles. The number of rectangles doesn't really matter. I was able to draw the grid with two loops. Now, I need for each of these 'squares' to contain a number and an identifier so that further on I can detect collisions with each individual square.
Hopefully I was clear and someone can help me out :)
Thanks,
Sam