mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
add gui.create_frame
This commit is contained in:
parent
3014329280
commit
463098aa1e
8 changed files with 84 additions and 24 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "elements/Label.hpp"
|
||||
#include "elements/Menu.hpp"
|
||||
#include "elements/Panel.hpp"
|
||||
#include "elements/Frame.hpp"
|
||||
#include "elements/UINode.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
#include "frontend/UiDocument.hpp"
|
||||
|
|
@ -262,6 +263,21 @@ void GUI::postAct() {
|
|||
}
|
||||
}
|
||||
|
||||
void GUI::renderFrames(const DrawContext& pctx, Assets& assets) {
|
||||
auto ctx = pctx.sub(batch2D.get());
|
||||
|
||||
auto uishader = assets.get<Shader>("ui");
|
||||
uishader->use();
|
||||
uishader->uniformMatrix("u_projview", uicamera->getProjView());
|
||||
|
||||
batch2D->begin();
|
||||
for (auto& [outputTexture, frame] : frames) {
|
||||
frame->updateOutput(assets);
|
||||
frame->draw(ctx, assets);
|
||||
}
|
||||
batch2D->flush();
|
||||
}
|
||||
|
||||
void GUI::draw(const DrawContext& pctx, const Assets& assets) {
|
||||
auto ctx = pctx.sub(batch2D.get());
|
||||
|
||||
|
|
@ -337,6 +353,10 @@ void GUI::add(std::shared_ptr<UINode> node) {
|
|||
container->add(std::move(node));
|
||||
}
|
||||
|
||||
void GUI::addFrame(std::shared_ptr<Frame> frame) {
|
||||
frames[frame->getOutputTexture()] = std::move(frame);
|
||||
}
|
||||
|
||||
void GUI::remove(UINode* node) noexcept {
|
||||
container->remove(node);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue