Files
EnergyMonitor_Pico/libs/mare/mare_drawables.cpp
2021-05-25 22:35:25 +02:00

56 lines
1.6 KiB
C++

#include "mare.h"
namespace Render {
Drawable::Drawable(const size_t id, Drawable* parent, Mare* engine):
_id(id),
_parent(parent),
_engine(engine)
{
printf("Created Drawable id: %d\n", _id);
}
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
//Point
DrawablePoint::DrawablePoint(const size_t id, Drawable* parent, Mare* engine, dim_t size):
Drawable(id, parent,engine),
_size(size)
{
}
void DrawablePoint::render() {
uint8_t *buf;
if (parent() == nullptr)
buf = engine()->bBuffer();
else
buf = engine()->fBuffer();
for (uint16_t xx(0); xx< _size.x; xx++){
for (uint16_t yy(0); yy < _size.y; yy++)
{
engine()->setPixel(buf,getOrigin().x+xx,getOrigin().y+yy,true);
}
}
}
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
//Line
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
//Rectangle
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
//Circle
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
//Character
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
//String
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
//Custom
}