Screenshot support, another example added
[taruga.git] / src / main.cpp
blobf6f00240802c1092f60c333654564179e0f1a03f
1 #include "include/taruga.hpp"
3 //! Development file of Taruga. Will be deleted once this is no longer a WIP.
5 //! Draws a Sierpinski fractal
6 void draw_spierpinski(taruga::Turtle& t, const int length, int depth)
8 if(depth == 0)
10 for(int i = 0; i < 3; i++)
12 t.forward(length);
13 t.turn_left(120);
15 return;
17 draw_spierpinski(t, length/2, depth-1);
18 t.forward(length/2);
19 draw_spierpinski(t, length/2, depth-1);
20 t.backwards(length/2);
21 t.turn_left(60);
22 t.forward(length/2);
23 t.turn_right(60);
24 draw_spierpinski(t, length/2, depth-1);
25 t.turn_left(60);
26 t.backwards(length/2);
27 t.turn_right(60);
31 int main()
33 taruga::Turtle turtle;
35 int size = 1;
36 while (size <= 250)
38 turtle.forward(size);
39 turtle.turn_right(91);
40 size++;
43 turtle.save_to_image("screenshot.png");
44 turtle.act();
46 return 0;