mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
refactor
This commit is contained in:
parent
5fe5c6b27a
commit
5ffc054d75
16 changed files with 212 additions and 126 deletions
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
using namespace gui;
|
||||
|
||||
GUI::GUI() {
|
||||
GUI::GUI() : batch2D(std::make_unique<Batch2D>(1024)) {
|
||||
container = std::make_shared<Container>(glm::vec2(1000));
|
||||
uicamera = std::make_unique<Camera>(glm::vec3(), Window::height);
|
||||
uicamera->perspective = false;
|
||||
|
|
@ -198,7 +198,9 @@ void GUI::act(float delta, const Viewport& vp) {
|
|||
}
|
||||
|
||||
void GUI::draw(const DrawContext& pctx, const Assets& assets) {
|
||||
auto& viewport = pctx.getViewport();
|
||||
auto ctx = pctx.sub(batch2D.get());
|
||||
|
||||
auto& viewport = ctx.getViewport();
|
||||
glm::vec2 wsize = viewport.size();
|
||||
|
||||
menu->setPos((wsize - menu->getSize()) / 2.0f);
|
||||
|
|
@ -208,8 +210,8 @@ void GUI::draw(const DrawContext& pctx, const Assets& assets) {
|
|||
uishader->use();
|
||||
uishader->uniformMatrix("u_projview", uicamera->getProjView());
|
||||
|
||||
pctx.getBatch2D()->begin();
|
||||
container->draw(pctx, assets);
|
||||
batch2D->begin();
|
||||
container->draw(ctx, assets);
|
||||
}
|
||||
|
||||
std::shared_ptr<UINode> GUI::getFocused() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue