Picture Placement Problem August 01, 2009 08:08AM | Registered: 15 years ago Posts: 444 |
DIR *dp; struct dirent *ep; if(opendir("SD:/apps")){ //If the apps folder exists dp = opendir("SD:/apps"); while((ep = readdir(dp))){ dircounter++; strcpy(path,"SD:/apps/"); strcat(path,(ep->d_name)); applist[dircounter].setDir(path); } closedir(dp); }another weird thing that is happening is that, i think my code tells it to save the correct path to setPngDir(), but it ends up saving the path to setDir()(The path is the path to the icon.png)
for(i=3;i<=dircounter;i++){ if(opendir(applist.getDir())){ // Good practice dp = opendir(applist.getDir()); while((ep = readdir(dp))){ //While there is a directory to read if (strcmp(strlower(ep->d_name), "icon.png") == 0){ strcpy(path,applist.getDir()); strcat(path,"/icon.png"); applist.setPngDir(path); } } } }
//App object class appobj { public: //Accessor methods appname string getName() {return appname;} void setName(string name) { appname = name;} //hasdol bool getDol() {return hasdol;} void setDol(bool dol) { hasdol = dol;} //appdir string getDir() {return appdir;} void setDir(string dir) { appdir = dir;} //pngdir string getPngDir() {return pngdir;} void setPngDir(string pdir) { pngdir = pdir;} //coder string getCoder() {return coder;} void setCoder(string cod) { coder = cod;} //v_info string getVInfo() {return v_info;} void setVInfo(string vin) { v_info = vin;} //date string getDate() {return date;} void setDate(string dat) { date = dat;} //s_desc string getShortD() {return s_desc;} void setShortD(string sdes) { s_desc = sdes;} //l_desc string getLongD() {return l_desc;} void setLongD(string ldes) { l_desc = ldes;} //appnmbr int getNumber() {return appnmbr;} void setNumber(int nmbr) { appnmbr = nmbr;} Image appimg; Sprite appspr; private: string appname; bool hasdol; string appdir; string pngdir; string coder; string v_info; string date; string s_desc;//Short description string l_desc;//Long description int appnmbr; };
Re: Picture Placement Problem August 02, 2009 10:05PM | Admin Registered: 16 years ago Posts: 5,132 |
Re: Picture Placement Problem August 16, 2009 06:48PM | Registered: 15 years ago Posts: 444 |
i = 3;//Replace the pictues tester = 3; for(y=30;y<480;y+=(48+30)){ for(x=28;x<640;x+=(128+25)){ if(applist.getOver() == false){ // If the mouse is not of the picture applist.appspr.SetStretchWidth(1); // Set Strech to normal applist.appspr.SetStretchHeight(1); applist.appspr.SetPosition(x,y); //Set Position to normal tester++; // If tester is the same as i, then no picture is selected } i++; } }test, getOver, and the stretch stuff is only used for zooming on an icon when i select it
Re: Picture Placement Problem August 29, 2009 05:57AM | Registered: 15 years ago Posts: 444 |
Re: Picture Placement Problem August 31, 2009 05:10AM | Registered: 15 years ago Posts: 444 |
if(opendir("SD:/apps")){ //If the apps folder exists dp = opendir("SD:/apps"); while((ep = readdir(dp))){ dircounter++; strcpy(path,"SD:/apps/"); strcat(path,(ep->d_name)); applist[dircounter].setDir(path); } closedir(dp); }the same value is in every applist[dircounter].setDir(). That value is also the last value that is read by ep = readdir(dp)