tmp
This commit is contained in:
parent
2160dfca34
commit
8171ba03da
7 changed files with 135 additions and 56 deletions
|
|
@ -2,14 +2,48 @@
|
|||
#include "Render.hpp"
|
||||
|
||||
namespace tp {
|
||||
|
||||
template <typename Events, typename Canvas>
|
||||
class ShortcutsTest : public Widget<Events, Canvas> {
|
||||
public:
|
||||
ShortcutsTest() { this->createConfig("ShortcutsTest"); }
|
||||
|
||||
void action(const Events&) {
|
||||
//
|
||||
}
|
||||
|
||||
void proc(const Events& events, const RectF& areaParent, const RectF& aArea) override {
|
||||
this->mArea = aArea;
|
||||
this->mVisible = areaParent.isOverlap(aArea);
|
||||
if (!this->mVisible) return;
|
||||
}
|
||||
|
||||
void draw(Canvas& canvas) override {
|
||||
if (!this->mVisible) return;
|
||||
canvas.rect(this->mArea, this->getColor("Base"));
|
||||
}
|
||||
|
||||
void populateConfig() override {
|
||||
this->addColor("Base", "Base");
|
||||
|
||||
this->addOperator("OperatorName", { this, [](void* self, const Events& events) {
|
||||
((ShortcutsTest*) self)->action(events);
|
||||
} });
|
||||
|
||||
this->getShortcuts("OperatorName").append({ { "Alt", "Hold" }, { "Mouse1", "Hold" } });
|
||||
this->getShortcuts("OperatorName").append({ { "Alt", "Hold" }, { "Mouse1", "Hold" } });
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Events, typename Canvas>
|
||||
class ViewportWidget : public Widget<Events, Canvas> {
|
||||
public:
|
||||
explicit ViewportWidget(Canvas* canvas, Scene* geometry, Vec2F renderResolution) :
|
||||
mRender(renderResolution) {
|
||||
mGeometry = geometry;
|
||||
this->createConfig("ViewportWidget");
|
||||
|
||||
mImage = canvas->createImageFromTextId(mRender.getRenderBuffer(), mRender.getBufferSize());
|
||||
mGeometry = geometry;
|
||||
mCanvas = canvas;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue