rectagle outline drawing
This commit is contained in:
@@ -21,14 +21,11 @@ extern "C" {
|
||||
|
||||
namespace Render{
|
||||
|
||||
struct pos_t {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
};
|
||||
typedef int32_t p_t;
|
||||
|
||||
struct spos_t {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
struct pos_t {
|
||||
p_t x;
|
||||
p_t y;
|
||||
};
|
||||
|
||||
struct bbox2d_t {
|
||||
@@ -56,6 +53,8 @@ namespace Render{
|
||||
class Page;
|
||||
class Drawable;
|
||||
class DrawablePoint;
|
||||
class DrawableLine;
|
||||
class DrawableRectangle;
|
||||
|
||||
typedef pos_t dim_t;
|
||||
typedef std::vector<std::shared_ptr<Page>> Pages;
|
||||
@@ -105,7 +104,7 @@ namespace Render{
|
||||
public:
|
||||
void render();
|
||||
void setPixel(uint8_t* img, uint16_t x, uint16_t y, BlendMode bm);
|
||||
spos_t rotateXY(int16_t x, int16_t y, float rot);
|
||||
pos_t rotateXY(int16_t x, int16_t y, float rot);
|
||||
void clearScreen();
|
||||
|
||||
// members
|
||||
@@ -182,6 +181,7 @@ namespace Render{
|
||||
};
|
||||
|
||||
class DrawableLine: public Drawable {
|
||||
friend class DrawableRectangle;
|
||||
|
||||
public:
|
||||
DrawableLine(const size_t id, Drawable* parent, Mare* engine);
|
||||
@@ -190,12 +190,10 @@ namespace Render{
|
||||
public:
|
||||
void setThickness(uint16_t thickness) {_thickness = thickness;};
|
||||
const uint16_t getThickness() {return _thickness;};
|
||||
void setRotation(float rotation) {_rotation = rotation;};
|
||||
const float getRotation() {return _rotation;};
|
||||
void setLength(uint16_t length) {_lenght = length;};
|
||||
const uint16_t getLength() {return _lenght;};
|
||||
void setOutline(bool outline) {_outline = outline;};
|
||||
const bool getOutline() {return _outline;};
|
||||
void setRotation(uint16_t rotation) {_rotation = rotation;};
|
||||
const uint16_t getRotation() {return _rotation;};
|
||||
void setLength(uint16_t length) {_length = length;};
|
||||
const uint16_t getLength() {return _length;};
|
||||
|
||||
private:
|
||||
void render(); // difficult business
|
||||
@@ -203,23 +201,40 @@ namespace Render{
|
||||
// members
|
||||
private:
|
||||
uint16_t _thickness;
|
||||
uint16_t _lenght;
|
||||
float _rotation;
|
||||
bool _outline;
|
||||
uint16_t _length;
|
||||
uint16_t _rotation;
|
||||
};
|
||||
|
||||
class DrawableRectangle: public Drawable {
|
||||
|
||||
DrawableRectangle();
|
||||
~DrawableRectangle();
|
||||
public:
|
||||
DrawableRectangle(const size_t id, Drawable* parent, Mare* engine);
|
||||
~DrawableRectangle();
|
||||
|
||||
public:
|
||||
void setThickness(uint16_t thickness) {_thickness = thickness;};
|
||||
const uint16_t getThickness() {return _thickness;};
|
||||
void setRotation(uint16_t rotation) {_rotation = rotation;};
|
||||
const uint16_t getRotation() {return _rotation;};
|
||||
void setDimension(dim_t dim) {_dim = dim;};
|
||||
const dim_t getDimension() {return _dim;};
|
||||
void setOutline(bool outline) {_outline = outline;};
|
||||
const bool getOutline() {return _outline;};
|
||||
|
||||
private:
|
||||
void render() {};
|
||||
void createOutline();
|
||||
void render();
|
||||
|
||||
// members
|
||||
private:
|
||||
DrawableLine* l1 = nullptr;
|
||||
DrawableLine* l2 = nullptr;
|
||||
DrawableLine* l3 = nullptr;
|
||||
DrawableLine* l4 = nullptr;
|
||||
uint16_t _thickness;
|
||||
uint16_t _rotation;
|
||||
dim_t _dim;
|
||||
bool _outline;
|
||||
};
|
||||
|
||||
class DrawableCircle: public Drawable {
|
||||
|
||||
Reference in New Issue
Block a user