add: RenderTarget

This commit is contained in:
Simon Hardt
2022-03-03 19:43:37 +01:00
parent 02562095d8
commit 420d4c9dc1
7 changed files with 161 additions and 21 deletions

View File

@@ -6,6 +6,7 @@
using namespace std::chrono_literals;
#include "display/EPD_7in5_V2.hpp"
#include "render/RenderTarget.hpp"
int main()
{
@@ -14,34 +15,22 @@ int main()
display.Init();
display.Clear(frame::display::Color::BLACK);
std::this_thread::sleep_for(2s);
display.Clear(frame::display::Color::WHITE);
std::this_thread::sleep_for(2s);
frame::render::RenderTarget target(display.getSize());
frame::Image image(display.getSize());
frame::Vector const center = (display.getSize() / 2);
for(int y = 0; y < 1; ++y)
for(int i = 0; i < 360; i += 45)
{
for(int x = 0; x < image.getWidth(); ++x)
{
image.at(x, y) = 0xFF;
}
auto end = center;
end.x += (int)std::cos(i * 0.01745329);
end.y += (int)std::sin(i * 0.01745329);
target.DrawLine(center, end);
}
for(int y = image.getHeight() - 1; y < image.getHeight(); ++y)
{
for(int x = 0; x < image.getWidth(); ++x)
{
image.at(x, y) = 0xFF;
}
}
display.Display(image);
display.Display(target.getImage());
std::this_thread::sleep_for(10s);