small fixes
This commit is contained in:
parent
9a01b5ad2d
commit
4c9019e03c
@ -262,7 +262,7 @@ void Hud::updateHotbarControl() {
|
||||
}
|
||||
}
|
||||
|
||||
void Hud::updateWorldGenDebugVisualization() {
|
||||
void Hud::updateWorldGenDebug() {
|
||||
auto& level = frontend.getLevel();
|
||||
const auto& chunks = *player.chunks;
|
||||
auto generator =
|
||||
@ -314,7 +314,9 @@ void Hud::update(bool visible) {
|
||||
const auto& chunks = *player.chunks;
|
||||
const auto& menu = gui.getMenu();
|
||||
|
||||
debugPanel->setVisible(debug && visible);
|
||||
debugPanel->setVisible(
|
||||
debug && visible && !(inventoryOpen && inventoryView == nullptr)
|
||||
);
|
||||
|
||||
if (!visible && inventoryOpen) {
|
||||
closeInventory();
|
||||
@ -358,7 +360,7 @@ void Hud::update(bool visible) {
|
||||
|
||||
debugMinimap->setVisible(debug && showGeneratorMinimap);
|
||||
if (debug && showGeneratorMinimap) {
|
||||
updateWorldGenDebugVisualization();
|
||||
updateWorldGenDebug();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ class Hud : public util::ObjectsKeeper {
|
||||
void dropExchangeSlot();
|
||||
|
||||
void showExchangeSlot();
|
||||
void updateWorldGenDebugVisualization();
|
||||
void updateWorldGenDebug();
|
||||
public:
|
||||
Hud(Engine& engine, LevelFrontend& frontend, Player& player);
|
||||
~Hud();
|
||||
|
||||
@ -262,7 +262,7 @@ void GUI::draw(const DrawContext& pctx, const Assets& assets) {
|
||||
auto pos = node->calcPos();
|
||||
auto size = node->getSize();
|
||||
|
||||
batch2D->setColor(0, 0, 255);
|
||||
batch2D->setColor(0, 255, 255);
|
||||
batch2D->lineRect(pos.x, pos.y, size.x-1, size.y-1);
|
||||
|
||||
node = node->getParent();
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
#include "typedefs.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Assets;
|
||||
class DrawContext;
|
||||
|
||||
@ -404,6 +404,12 @@ void TextBox::onFocus(GUI* gui) {
|
||||
}
|
||||
}
|
||||
|
||||
void TextBox::reposition() {
|
||||
auto size = getSize();
|
||||
UINode::reposition();
|
||||
refreshLabel();
|
||||
}
|
||||
|
||||
void TextBox::refresh() {
|
||||
Container::refresh();
|
||||
label->setSize(size-glm::vec2(padding.z+padding.x, padding.w+padding.y));
|
||||
|
||||
@ -210,6 +210,7 @@ namespace gui {
|
||||
virtual void setShowLineNumbers(bool flag);
|
||||
virtual bool isShowLineNumbers() const;
|
||||
|
||||
virtual void reposition() override;
|
||||
virtual void onFocus(GUI*) override;
|
||||
virtual void refresh() override;
|
||||
virtual void doubleClick(GUI*, int x, int y) override;
|
||||
|
||||
@ -301,9 +301,13 @@ const std::string& UINode::getId() const {
|
||||
void UINode::reposition() {
|
||||
if (sizefunc) {
|
||||
auto newSize = sizefunc();
|
||||
auto defsize = newSize;
|
||||
if (parent) {
|
||||
defsize = parent->getSize();
|
||||
}
|
||||
setSize(
|
||||
{newSize.x < 0 ? size.x : newSize.x,
|
||||
newSize.y < 0 ? size.y : newSize.y}
|
||||
{newSize.x < 0 ? defsize.x : newSize.x,
|
||||
newSize.y < 0 ? defsize.y : newSize.y}
|
||||
);
|
||||
}
|
||||
if (positionfunc) {
|
||||
|
||||
@ -250,7 +250,7 @@ namespace gui {
|
||||
const std::string& getId() const;
|
||||
|
||||
/// @brief Fetch pos from positionfunc if assigned
|
||||
void reposition();
|
||||
virtual void reposition();
|
||||
|
||||
virtual void setGravity(Gravity gravity);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user