Guest User

Untitled

a guest
Jan 9th, 2017
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1.  using namespace Graph_lib;
  2.     Point t1{100, 100};
  3.     Simple_window window{t1, 600, 460, "My window"};
  4.  
  5.     std::vector<Graph_lib::Rectangle> Rectangles; // mora ici iz std_lib_facilities.h
  6.  
  7.     bool red = true;
  8.     for (int i = 0; i < 3; i++)
  9.     {
  10.         int offset_x = 0;
  11.         int offset_y = i * 100;
  12.         for (int j = 0; j < 3; j++)
  13.         {
  14.             Graph_lib::Rectangle rect{Point{100 + offset_x, 100 + offset_y}, 100, 100};
  15.             if (red == true)
  16.             {
  17.                 rect.set_color(Color::red);
  18.             }
  19.             else
  20.             {
  21.                 rect.set_color(Color::white);
  22.             }
  23.             Rectangles.push_back(rect);
  24.             offset_x += 100;
  25.             red = !red;
  26.         }
  27.         offset_x = 0;
  28.     }
  29.     for (int i = 0; i < Rectangles.size(); i++)
  30.     {
  31.         window.attach(Rectangles[i]);
  32.     }
  33.     window.wait_for_button();
Advertisement
Add Comment
Please, Sign In to add comment