From 61ad839ebfa418a02aaefbc3976a164008cb3b4a Mon Sep 17 00:00:00 2001 From: MihailRis Date: Wed, 10 Jan 2024 16:46:36 +0300 Subject: [PATCH] Small optimization --- src/frontend/hud.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/frontend/hud.cpp b/src/frontend/hud.cpp index 0de969cb..832b61fd 100644 --- a/src/frontend/hud.cpp +++ b/src/frontend/hud.cpp @@ -244,8 +244,6 @@ void HudRenderer::update() { void HudRenderer::draw(const GfxContext& ctx){ auto level = frontend->getLevel(); - const Content* content = level->content; - const ContentIndices* contentIds = content->indices; const Viewport& viewport = ctx.getViewport(); const uint width = viewport.getWidth(); @@ -273,17 +271,10 @@ void HudRenderer::draw(const GfxContext& ctx){ } Player* player = level->player; + hotbarView->setPosition(width-56, height-56); + hotbarView->setItems({player->getChosenItem()}); + hotbarView->actAndDraw(&ctx); - { - Window::clearDepth(); - GfxContext subctx = ctx.sub(); - subctx.depthTest(true); - subctx.cullFace(true); - - hotbarView->setPosition(width-56, height-56); - hotbarView->setItems({player->getChosenItem()}); - hotbarView->actAndDraw(&subctx); - } uishader->use(); batch->begin();