fix console position
This commit is contained in:
parent
255c49916c
commit
3ea213e8d3
@ -14,7 +14,7 @@
|
|||||||
<panel id="problemsLog"
|
<panel id="problemsLog"
|
||||||
color="#00000010"
|
color="#00000010"
|
||||||
position-func="gui.get_viewport()[1]-350,0"
|
position-func="gui.get_viewport()[1]-350,0"
|
||||||
size-func="351,gui.get_viewport()[2]-40"
|
size-func="350,gui.get_viewport()[2]-40"
|
||||||
padding="5,15,5,15">
|
padding="5,15,5,15">
|
||||||
<label>@Problems</label>
|
<label>@Problems</label>
|
||||||
</panel>
|
</panel>
|
||||||
|
|||||||
@ -615,8 +615,11 @@ void Hud::updateElementsPosition(const Viewport& viewport) {
|
|||||||
}
|
}
|
||||||
if (secondUI->getPositionFunc() == nullptr) {
|
if (secondUI->getPositionFunc() == nullptr) {
|
||||||
secondUI->setPos(glm::vec2(
|
secondUI->setPos(glm::vec2(
|
||||||
glm::min(width/2-invwidth/2, width-caWidth-(inventoryView ? 10 : 0)-invwidth),
|
glm::min(
|
||||||
height/2-totalHeight/2
|
width / 2.f - invwidth / 2.f,
|
||||||
|
width - caWidth - (inventoryView ? 10 : 0) - invwidth
|
||||||
|
),
|
||||||
|
height / 2.f - totalHeight / 2.f
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,7 +148,7 @@ void DrawContext::setBlendMode(BlendMode mode) {
|
|||||||
set_blend_mode(mode);
|
set_blend_mode(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawContext::setScissors(glm::vec4 area) {
|
void DrawContext::setScissors(const glm::vec4& area) {
|
||||||
Window::pushScissor(area);
|
Window::pushScissor(area);
|
||||||
scissorsCount++;
|
scissorsCount++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,6 @@ public:
|
|||||||
void setDepthTest(bool flag);
|
void setDepthTest(bool flag);
|
||||||
void setCullFace(bool flag);
|
void setCullFace(bool flag);
|
||||||
void setBlendMode(BlendMode mode);
|
void setBlendMode(BlendMode mode);
|
||||||
void setScissors(glm::vec4 area);
|
void setScissors(const glm::vec4& area);
|
||||||
void setLineWidth(float width);
|
void setLineWidth(float width);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -90,7 +90,7 @@ void Container::draw(const DrawContext* pctx, Assets* assets) {
|
|||||||
if (!nodes.empty()) {
|
if (!nodes.empty()) {
|
||||||
batch->flush();
|
batch->flush();
|
||||||
DrawContext ctx = pctx->sub();
|
DrawContext ctx = pctx->sub();
|
||||||
ctx.setScissors(glm::vec4(pos.x, pos.y, size.x, size.y));
|
ctx.setScissors(glm::vec4(pos.x, pos.y, glm::ceil(size.x), glm::ceil(size.y)));
|
||||||
for (const auto& node : nodes) {
|
for (const auto& node : nodes) {
|
||||||
if (node->isVisible())
|
if (node->isVisible())
|
||||||
node->draw(pctx, assets);
|
node->draw(pctx, assets);
|
||||||
@ -108,7 +108,7 @@ void Container::drawBackground(const DrawContext* pctx, Assets*) {
|
|||||||
auto batch = pctx->getBatch2D();
|
auto batch = pctx->getBatch2D();
|
||||||
batch->texture(nullptr);
|
batch->texture(nullptr);
|
||||||
batch->setColor(color);
|
batch->setColor(color);
|
||||||
batch->rect(pos.x, pos.y, size.x, size.y);
|
batch->rect(pos.x, pos.y, glm::ceil(size.x), glm::ceil(size.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Container::add(const std::shared_ptr<UINode> &node) {
|
void Container::add(const std::shared_ptr<UINode> &node) {
|
||||||
|
|||||||
@ -258,14 +258,14 @@ void Window::pushScissor(glm::vec4 area) {
|
|||||||
}
|
}
|
||||||
scissorStack.push(scissorArea);
|
scissorStack.push(scissorArea);
|
||||||
|
|
||||||
area.z += area.x;
|
area.z += glm::ceil(area.x);
|
||||||
area.w += area.y;
|
area.w += glm::ceil(area.y);
|
||||||
|
|
||||||
area.x = fmax(area.x, scissorArea.x);
|
area.x = glm::max(area.x, scissorArea.x);
|
||||||
area.y = fmax(area.y, scissorArea.y);
|
area.y = glm::max(area.y, scissorArea.y);
|
||||||
|
|
||||||
area.z = fmin(area.z, scissorArea.z);
|
area.z = glm::min(area.z, scissorArea.z);
|
||||||
area.w = fmin(area.w, scissorArea.w);
|
area.w = glm::min(area.w, scissorArea.w);
|
||||||
|
|
||||||
if (area.z < 0.0f || area.w < 0.0f) {
|
if (area.z < 0.0f || area.w < 0.0f) {
|
||||||
glScissor(0, 0, 0, 0);
|
glScissor(0, 0, 0, 0);
|
||||||
@ -273,8 +273,8 @@ void Window::pushScissor(glm::vec4 area) {
|
|||||||
glScissor(
|
glScissor(
|
||||||
area.x,
|
area.x,
|
||||||
Window::height - area.w,
|
Window::height - area.w,
|
||||||
std::max(0, int(area.z - area.x)),
|
std::max(0, static_cast<int>(glm::ceil(area.z - area.x))),
|
||||||
std::max(0, int(area.w - area.y))
|
std::max(0, static_cast<int>(glm::ceil(area.w - area.y)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
scissorArea = area;
|
scissorArea = area;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user