64 lines
1.7 KiB
C++
64 lines
1.7 KiB
C++
#include "mare.h"
|
|
|
|
namespace Render {
|
|
|
|
Drawable::Drawable(const size_t id, Drawable* parent, Mare* engine):
|
|
_id(id),
|
|
_parent(parent),
|
|
_engine(engine)
|
|
{
|
|
}
|
|
|
|
Drawable::~Drawable() {
|
|
|
|
}
|
|
|
|
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
|
//Point
|
|
DrawablePoint::DrawablePoint(const size_t id, Drawable* parent, Mare* engine, dim_t size):
|
|
Drawable(id, parent,engine),
|
|
_size(size)
|
|
{
|
|
|
|
}
|
|
|
|
DrawablePoint::~DrawablePoint() {
|
|
|
|
}
|
|
|
|
void DrawablePoint::render() {
|
|
uint8_t *buf;
|
|
if (parent() == nullptr)
|
|
buf = engine()->bBuffer();
|
|
else
|
|
buf = engine()->fBuffer();
|
|
//TODO: implement screen rotation and margin check
|
|
auto dx = engine()->getSize().x;
|
|
for (uint16_t xx(0); xx< _size.x; xx++){
|
|
for (uint16_t yy(0); yy < _size.y; yy++)
|
|
{
|
|
engine()->setPixel(buf,dx-(getOrigin().x+xx),getOrigin().y+yy,true);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
|
//Line
|
|
|
|
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
|
//Rectangle
|
|
|
|
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
|
//Circle
|
|
|
|
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
|
//Character
|
|
|
|
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
|
//String
|
|
|
|
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
|
//Custom
|
|
|
|
} |