change config box positions to proportions
This commit is contained in:
parent
53d6fc3664
commit
4ccffe4636
1 changed files with 5 additions and 5 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue