hello,
ich have a txt file made of this structure:
11111 #FF00FF
11112 #FF0000
11115 #FF0FF0
and so on.
so first you have a number and seperated by a tab there is a hexcode.
Now inside of my processing sketch one can type a number (like 11111 oder 11112). those are saved in a buffer-string and then converted to an int. And now: When pressing "Enter" i want to fill a rect in the matching number above. so when typing 11111 i want to fill it with FF00FF and so on.
how can i get processing to find the relevant number inside of the sketch?
i once had a different sketch with this txt file....
01 #FF0000
02 #FFFFFF
03 #FF00FF
i therefore used this sketch:
Code: void FillFunction() {
String[] lines = loadStrings("colors.txt");
int[] colorList = new int[lines.length];
for (int i = 0; i < lines.length; i++) {
// I assume that it's tabs separating the columns
int tab = lines[i].indexOf(TAB);
// Skip over the TAB character, and the # character
String stuff = lines[i].substring(tab + 2);
// Convert the color from hex
int c = unhex(stuff);
// Put it in the list, the 0xff part makes it opaque
colorList[i] = 0xFF000000 | c;
int_color = colorList[int_plz - 1];
}
}
does anyone has an idea how to solve this problem?
may use my sktech above and just change some parameters?
i'm glad for any help!!!!