gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
polygon.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "../../bounds.hpp"
5#include "../shape.hpp"
6
7#include <initializer_list>
8#include <vector>
9
10namespace ui {
11
16struct Polygon : public Shape {
18 bool fill;
22 std::vector<Coords> points;
23
30 Polygon(color_t color, const std::initializer_list<Coords> &&points, bool fill = false);
31
37 Polygon(color_t color, bool fill = false);
38
39 void renderAt(const Coords &coords, const shader_t &shader) const override;
40
41 Size getSize() const override;
42
43private:
44 Bounds getBounds() const;
45};
46
47} // namespace ui
uint16_t color_t
An RGB565 color value. 5 bits red, 6 bits green, 5 bits blue.
Definition color.hpp:13
shader_animated_t shader_t
A pixel shader that may or may not update based on the current time.
Definition renderable.hpp:48
A struct that holds the pixel space that a widget would take up on the screen.
Definition bounds.hpp:11
A struct for storing the pixel coordinates of various UI elements.
Definition coords.hpp:17
A basic 2D polygon.
Definition polygon.hpp:16
std::vector< Coords > points
The polygon vertices.
Definition polygon.hpp:22
color_t color
The color of the polygon.
Definition polygon.hpp:20
Size getSize() const override
Get the size of the renderable.
bool fill
Whether the shape is filled or just an outline.
Definition polygon.hpp:18
Polygon(color_t color, const std::initializer_list< Coords > &&points, bool fill=false)
Construct polygon from a set list of points.
Polygon(color_t color, bool fill=false)
Construct a polygon without any points.
void renderAt(const Coords &coords, const shader_t &shader) const override
Display the renderable directly onto the screen.
The common interface for rendering arbitrary shapes.
Definition shape.hpp:11
A struct that holds the number of pixels that a widget would take up on the screen.
Definition size.hpp:17