placeholders fro drawables
This commit is contained in:
156
libs/mare/mare.h
156
libs/mare/mare.h
@@ -1,22 +1,164 @@
|
||||
/*******************************************
|
||||
* Most Awesome Renderer Ever
|
||||
*******************************************/
|
||||
#pragma once
|
||||
|
||||
#include <DEV_Config.h>
|
||||
#include <EPD_2in9b_V3.h>
|
||||
#include <fonts.h>
|
||||
extern "C" {
|
||||
#include <DEV_Config.h>
|
||||
#include <EPD_2in9b_V3.h>
|
||||
#include <fonts.h>
|
||||
}
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace Render{
|
||||
|
||||
struct pos_t {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
};
|
||||
|
||||
struct bbox2d_t {
|
||||
uint16_t xMin, Ymin;
|
||||
uint16_t Xmax, Ymax;
|
||||
};
|
||||
|
||||
enum class ScreenRotation {
|
||||
Rot0 = 0,
|
||||
Rot90 = 90,
|
||||
Rot180 = 180,
|
||||
Rot270 = 270
|
||||
};
|
||||
|
||||
enum class BlendMode {
|
||||
Add,
|
||||
Intersect
|
||||
};
|
||||
|
||||
class Page;
|
||||
class Drawable;
|
||||
|
||||
typedef pos_t dim_t;
|
||||
typedef std::vector<Page*> Pages;
|
||||
typedef std::vector<Drawable*> Drawables;
|
||||
|
||||
class Mare {
|
||||
Mare();
|
||||
virtual ~Mare();
|
||||
|
||||
// getters, setters
|
||||
public:
|
||||
Mare();
|
||||
virtual ~Mare();
|
||||
void setSize(const uint16_t x, const uint16_t y);
|
||||
const dim_t getSize();
|
||||
void setRotation(const ScreenRotation r);
|
||||
const ScreenRotation getRotation();
|
||||
|
||||
const Pages& getPages();
|
||||
const uint8_t getCurrentPage();
|
||||
void setCurrentPage(const uint8_t p);
|
||||
|
||||
const Drawables& getDrawables();
|
||||
|
||||
// drawables, pages
|
||||
public:
|
||||
void addDrawable();
|
||||
void removeDrawable(size_t id);
|
||||
void addPage(uint8_t num);
|
||||
void removePage(uint8_t num);
|
||||
|
||||
private:
|
||||
void visitDrawables(Drawable* parent);
|
||||
void render();
|
||||
void setPixel(uint16_t x, uint16_t y, bool value);
|
||||
|
||||
// members
|
||||
private:
|
||||
uint8_t* _screenBufferForeground;
|
||||
uint8_t* _screenBufferBackgrund;
|
||||
dim_t _screenSize;
|
||||
Pages _pages;
|
||||
Drawables _drawables;
|
||||
ScreenRotation _rotation;
|
||||
};
|
||||
|
||||
class Drawable {
|
||||
|
||||
Drawable(const size_t id, const pos_t position, const Drawable* parent);
|
||||
virtual ~Drawable();
|
||||
|
||||
public:
|
||||
void render();
|
||||
virtual void render();
|
||||
|
||||
public:
|
||||
void setId(const size_t id);
|
||||
void setOrigin(const pos_t origin);
|
||||
void setDirty();
|
||||
void setBlendMode(const BlendMode mode);
|
||||
|
||||
const bbox2d_t getBBox();
|
||||
const BlendMode getBlendMode();
|
||||
|
||||
private:
|
||||
int _var;
|
||||
bool _dirty;
|
||||
size_t _id;
|
||||
pos_t _origin;
|
||||
bbox2d_t _bbox;
|
||||
Drawables _children;
|
||||
Drawable* _parent;
|
||||
|
||||
};
|
||||
|
||||
class DrawablePoint: public Drawable {
|
||||
|
||||
DrawablePoint();
|
||||
~DrawablePoint();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
void render();
|
||||
|
||||
// members
|
||||
private:
|
||||
};
|
||||
|
||||
class DrawableLine: public Drawable {
|
||||
|
||||
DrawableLine();
|
||||
~DrawableLine();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
void render() {};
|
||||
|
||||
// members
|
||||
private:
|
||||
};
|
||||
|
||||
class DrawableRectangle: public Drawable {
|
||||
|
||||
DrawableRectangle();
|
||||
~DrawableRectangle();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
void render() {};
|
||||
|
||||
// members
|
||||
private:
|
||||
};
|
||||
|
||||
class Page {
|
||||
|
||||
Page();
|
||||
~Page();
|
||||
|
||||
public:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
}
|
||||
31
libs/mare/mare_drawables.cpp
Normal file
31
libs/mare/mare_drawables.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "mare.h"
|
||||
|
||||
namespace Render {
|
||||
|
||||
Drawable::Drawable(const size_t id, const pos_t position, const Drawable* parent) {
|
||||
|
||||
}
|
||||
|
||||
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
||||
//Point
|
||||
|
||||
|
||||
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
||||
//Line
|
||||
|
||||
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
||||
//Rectangle
|
||||
|
||||
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
||||
//Circle
|
||||
|
||||
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
||||
//Character
|
||||
|
||||
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
||||
//String
|
||||
|
||||
//--------+--------+--------+--------+--------+--------+--------+--------+--------+--------//
|
||||
//Custom
|
||||
|
||||
}
|
||||
10
libs/mare/mare_pages.cpp
Normal file
10
libs/mare/mare_pages.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "mare.h"
|
||||
|
||||
namespace Render {
|
||||
|
||||
Page::Page(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user