tutorialsc++
4. shapes and colours
rounded rects, circles, outlines and lines
swap the orange box for these, still inside paint and under the background
// a plain box, then the same box with rounded corners, 12 is how round
_r.fill_rect({ 40, 40, 120, 80 }, gui::colour_t::rgb(0xE06040));
_r.fill_round_rect({ 180, 40, 120, 80 }, 12.0f, gui::colour_t::rgb(0x40A0E0));
// an ellipse fills the rect it is given, so a square rect makes a circle
_r.fill_ellipse({ 320, 40, 80, 80 }, gui::colour_t::rgb(0x60C060));
// stroke draws just the outline, 3 px thick
_r.stroke_rect({ 420, 40, 120, 80 }, gui::colour_t::rgb(0xE0C040), 3.0f);
// a line from one point to another, 2 px thick
_r.draw_line({ 40, 160 }, { 540, 160 }, gui::colour_t::rgb(0xFFFFFF), 2.0f);fill_* | fills the shape in |
stroke_* | the outline only, the last number is how thick |
| every fill has a stroke twin | stroke_round_rect, stroke_ellipse, same args plus the thickness |
rgb vs argb | argb takes an alpha up front, so 0x80E06040 is the orange at half see through |
you should see the orange box, a blue rounded box, a green circle and a yellow outline in a row, with a white line under them