change config box positions to proportions

This commit is contained in:
interfisch 2019-10-04 13:28:25 +02:00
parent 53d6fc3664
commit 4ccffe4636

View file

@ -384,7 +384,7 @@ void mouseClicked() {
void saveBoxConfig(){
String[] boxconfig=new String[boxnum];
for (int i=0;i<boxnum;i++) {
boxconfig[i]=boxid[i]+";"+int(boxpos[i].x)+";"+int(boxpos[i].y)+";"+int(boxsize[i].x)+";"+int(boxsize[i].y);
boxconfig[i]=boxid[i]+";"+float(1.0*boxpos[i].x/kinect.width)+";"+float(1.0*boxpos[i].y/kinect.height)+";"+float(1.0*boxsize[i].x/kinect.width)+";"+float(1.0*boxsize[i].y/kinect.height);
}
saveStrings("boxconfig.txt", boxconfig);
println("saved");
@ -400,10 +400,10 @@ void loadBoxConfig(){
for (int i=0;i<min(boxconfig.length,boxnum);i++) {
String[] _boxconfsplit=split(boxconfig[i], ';');
boxid[i]=int(_boxconfsplit[0]);
boxpos[i].x=int(_boxconfsplit[1]);
boxpos[i].y=int(_boxconfsplit[2]);
boxsize[i].x=int(_boxconfsplit[3]);
boxsize[i].y=int(_boxconfsplit[4]);
boxpos[i].x=int(_boxconfsplit[1]*kinect.width);
boxpos[i].y=int(_boxconfsplit[2]*kinect.height);
boxsize[i].x=int(_boxconfsplit[3]*kinect.width);
boxsize[i].y=int(_boxconfsplit[4]*kinect.height);
boxenabled[i]=true;
}
println("loaded");