Guest User

Untitled

a guest
May 1st, 2024
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. drx::util::IMAP<drx::gfx::COLOR>* clrs = new drx::util::IMAP<drx::gfx::COLOR>;
  2. SINT counter = 0;
  3. std::mutex* m = new std::mutex;
  4. while (!this->fs.eof()) {
  5.     this->fs.getline(line, 256);
  6.  
  7.     this->pool.Queue([=, &counter] {
  8.         std::unique_lock<std::mutex> lock(*m);
  9.         /*
  10.             Parse line
  11.         */
  12.         counter++;
  13.     });                            
  14. }
  15.  
  16. do { std::this_thread::sleep_for(std::chrono::milliseconds(1)); } while (this->pool.job.size() > 0);
  17. // done, set colors to sprite
  18.  
  19. to.size = { 0, 0, wt, ht };
  20. for (int x = 0; x < to.size.w; x++) {
  21.     drx:util::IMAP<drx::gfx::COLOR> clr;
  22.     to.pixel << clr;
  23. }
  24.  
  25. for (int p = 0, x = 0, y = 0; p < clrs->length; p++) {
  26.     if (!clrs->Null(p)) {
  27.         to.pixel[x] << *clrs->package[p].item;
  28.     } else {
  29.         drx::gfx::COLOR color = { 0, 0, 0, 1 };
  30.         to.pixel[x] << color;
  31.     }
  32.     y++;
  33.     if (y == to.size.h) {
  34.         y = 0;
  35.         x++;
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment