thecplusplusguy

loadAnimation - OpenGL, SDL, C++

Oct 23rd, 2011
1,415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. //http://www.youtube.com/user/thecplusplusguy
  2. //paste this to the end of your functions.cpp file (the earlier version is uploaded here)
  3. //I will not upload the functions.h, just copy the prototype to there.
  4. void loadAnimation(std::vector<unsigned int>& frames,std::string filename,unsigned int num,objloader& obj)
  5. {
  6.     char tmp[200];
  7.     for(int i=1;i<=num;i++)
  8.     {
  9.         if(i<10)
  10.             sprintf(tmp,"_00000%d",i);
  11.         else if(i<100)
  12.             sprintf(tmp,"_0000%d",i);
  13.         else if(i<1000)
  14.             sprintf(tmp,"_000%d",i);
  15.         else if(i<10000)
  16.             sprintf(tmp,"_00%d",i);
  17.         else if(i<100000)
  18.             sprintf(tmp,"_0%d",i); 
  19.         else if(i<1000000)
  20.             sprintf(tmp,"_%d",i);  
  21.         std::string tmp2(filename+tmp);
  22.         tmp2+=".obj";
  23.         std::cout << tmp2 << std::endl;
  24.         unsigned int id=obj.load(tmp2);
  25.         frames.push_back(id);
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment