Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using namespace Graph_lib;
- Point t1{100, 100};
- Simple_window window{t1, 600, 460, "My window"};
- std::vector<Graph_lib::Rectangle> Rectangles; // mora ici iz std_lib_facilities.h
- bool red = true;
- for (int i = 0; i < 3; i++)
- {
- int offset_x = 0;
- int offset_y = i * 100;
- for (int j = 0; j < 3; j++)
- {
- Graph_lib::Rectangle rect{Point{100 + offset_x, 100 + offset_y}, 100, 100};
- if (red == true)
- {
- rect.set_color(Color::red);
- }
- else
- {
- rect.set_color(Color::white);
- }
- Rectangles.push_back(rect);
- offset_x += 100;
- red = !red;
- }
- offset_x = 0;
- }
- for (int i = 0; i < Rectangles.size(); i++)
- {
- window.attach(Rectangles[i]);
- }
- window.wait_for_button();
Advertisement
Add Comment
Please, Sign In to add comment