gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
renderable.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include <functional>
5
6#include "color.hpp"
7#include "coords.hpp"
8#include "size.hpp"
9
10namespace ui {
11
22typedef std::function<color_t(color_t color, const Coords &coords, const Size &size)> shader_oneframe_t;
23
35typedef std::function<color_t(color_t color, const Coords &coords, const Size &size, time_t time)> shader_animated_t;
36
49
55struct Renderable {
61 virtual void renderAt(const Coords &coords, const shader_t &shader = 0) const = 0;
62
67 virtual Size getSize() const = 0;
68};
69
70}; // namespace ui
uint16_t color_t
An RGB565 color value. 5 bits red, 6 bits green, 5 bits blue.
Definition color.hpp:13
std::function< color_t(color_t color, const Coords &coords, const Size &size, time_t time)> shader_animated_t
A pixel shader that may update based on the current time.
Definition renderable.hpp:35
shader_animated_t shader_t
A pixel shader that may or may not update based on the current time.
Definition renderable.hpp:48
std::function< color_t(color_t color, const Coords &coords, const Size &size)> shader_oneframe_t
A pixel shader that's independent of the current time.
Definition renderable.hpp:22
A struct for storing the pixel coordinates of various UI elements.
Definition coords.hpp:17
An abstract interface for arbitrary renderable objects.
Definition renderable.hpp:55
virtual void renderAt(const Coords &coords, const shader_t &shader=0) const =0
Display the renderable directly onto the screen.
virtual Size getSize() const =0
Get the size of the renderable.
A struct that holds the number of pixels that a widget would take up on the screen.
Definition size.hpp:17