render hollow circle, begin of rendering chars
This commit is contained in:
@@ -18,12 +18,15 @@ extern "C" {
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <math.h>
|
||||
#include <fonts.h>
|
||||
|
||||
namespace Render{
|
||||
|
||||
typedef int32_t p_t;
|
||||
|
||||
struct pos_t {
|
||||
friend bool operator==(const pos_t a, const pos_t b){ return a.x==b.x && a.y==b.y;};
|
||||
friend bool operator!=(const pos_t a, const pos_t b){ return a.x!=b.x || a.y!=b.y;};
|
||||
p_t x;
|
||||
p_t y;
|
||||
};
|
||||
@@ -50,11 +53,24 @@ namespace Render{
|
||||
Black
|
||||
};
|
||||
|
||||
enum class Font {
|
||||
Font8,
|
||||
Font12,
|
||||
Font16,
|
||||
Font20,
|
||||
Font24
|
||||
};
|
||||
|
||||
typedef ScreenRotation TextRotation;
|
||||
|
||||
class Page;
|
||||
class Drawable;
|
||||
class DrawablePoint;
|
||||
class DrawableLine;
|
||||
class DrawableRectangle;
|
||||
class DrawableCircle;
|
||||
class DrawableString;
|
||||
class DrawableCustom;
|
||||
|
||||
typedef pos_t dim_t;
|
||||
typedef std::vector<std::shared_ptr<Page>> Pages;
|
||||
@@ -244,45 +260,68 @@ namespace Render{
|
||||
};
|
||||
|
||||
class DrawableCircle: public Drawable {
|
||||
|
||||
DrawableCircle();
|
||||
~DrawableCircle();
|
||||
public:
|
||||
DrawableCircle(const size_t id, Drawable* parent, Mare* engine);
|
||||
~DrawableCircle();
|
||||
|
||||
public:
|
||||
void setThickness(uint16_t thickness) { _thickness = thickness; };
|
||||
const uint16_t getThickness() {return _thickness; };
|
||||
void setRadius(uint16_t radius) { _radius = radius; };
|
||||
const uint16_t getRadius() { return _radius; };
|
||||
void setOutline(bool outline) { _outline = outline; };
|
||||
const getOutline() { return _outline; };
|
||||
|
||||
private:
|
||||
void render() {};
|
||||
void render();
|
||||
|
||||
// members
|
||||
private:
|
||||
uint16_t _thickness;
|
||||
uint16_t _radius;
|
||||
bool _outline;
|
||||
};
|
||||
|
||||
class DrawableChar: public Drawable {
|
||||
|
||||
DrawableChar();
|
||||
~DrawableChar();
|
||||
friend class DrawableString;
|
||||
public:
|
||||
DrawableChar(const size_t id, Drawable* parent, Mare* engine, char c, Font f);
|
||||
~DrawableChar();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
void render() {};
|
||||
void render();
|
||||
|
||||
// members
|
||||
private:
|
||||
Font _fontEnum;
|
||||
_tFont _font;
|
||||
char _char;
|
||||
};
|
||||
|
||||
class DrawableString: public Drawable {
|
||||
|
||||
DrawableString();
|
||||
~DrawableString();
|
||||
public:
|
||||
DrawableString(const size_t id, Drawable* parent, Mare* engine, std::string &s, Font f);
|
||||
~DrawableString();
|
||||
|
||||
public:
|
||||
|
||||
void setString(std::string& s) { _s = s; };
|
||||
const std::string& getString() { return &s; };
|
||||
void setFont(Font f) { _fontEnum = f; };
|
||||
const Font getFont() { return _fontEnum; };
|
||||
void setRotation(TextRotation rotation) { _rotation = rotation; };
|
||||
const TextRotation getRotation() { return _rotation; };
|
||||
|
||||
private:
|
||||
void render() {};
|
||||
void render();
|
||||
|
||||
// members
|
||||
private:
|
||||
Font _fontEnum;
|
||||
TextRotation _rotation;
|
||||
std::string _s;
|
||||
std::vector<DrawableChar*> _chars;
|
||||
};
|
||||
|
||||
class DrawableCustom: public Drawable {
|
||||
|
||||
Reference in New Issue
Block a user