SHARE
TWEET

Untitled

JaminGrey Nov 7th, 2012 30 Never
  1. Common::Grid<std::string> grid(cRect(-1,-1,3,3), "O");
  2. grid.Resize(cRect(-2,-2,5,5), "X");
  3. grid.Expand(0, 2, 0, 0, ">");
  4. grid.Expand(2, 0, 0, 0, "<");
  5. grid.Expand(0, 1, "-");
  6.  
  7. grid[cPoint(0,0)] = "A";
  8.  
  9. unsigned int column = 0;
  10. for(const auto &element : grid)
  11. {
  12.     std::cout << element;
  13.          
  14.     column++;
  15.     if(column == 9)
  16.     {
  17.         column = 0;
  18.         std::cout << std::endl;
  19.     }
  20. }
  21.  
  22. Outputs:
  23. ---------
  24. <<XXXXX>>
  25. <<XOOOX>>
  26. <<XOAOX>>
  27. <<XOOOX>>
  28. <<XXXXX>>
  29. ---------
RAW Paste Data
Top