Working on minor bug fixing

This commit is contained in:
Vladislav Khorev committed 2026-03-10 18:03:16 +03:00
1 parent 5e7c050c68
commit 18674efd8e
15 files changed
+90 -24

No files matched your search

+13 -6
View File
@@ -103,10 +103,7 @@ namespace ZL {
}
void UiTextButton::draw(Renderer& renderer) const {
renderer.PushMatrix();
renderer.TranslateMatrix({ animOffsetX, animOffsetY, 0.0f });
renderer.ScaleMatrix({ animScaleX, animScaleY, 1.0f });
// Draw background texture (optional)
const std::shared_ptr<Texture>* tex = nullptr;
switch (state) {
@@ -115,20 +112,30 @@ namespace ZL {
case ButtonState::Pressed: tex = texPressed ? &texPressed : (texNormal ? &texNormal : nullptr); break;
case ButtonState::Disabled: tex = texDisabled ? &texDisabled : (texNormal ? &texNormal : nullptr); break;
}
glDisable(GL_DEPTH_TEST);
if (tex && *tex) {
renderer.shaderManager.PushShader(defaultShaderName);
renderer.PushMatrix();
renderer.TranslateMatrix({ animOffsetX, animOffsetY, 0.0f });
renderer.ScaleMatrix({ animScaleX, animScaleY, 1.0f });
renderer.RenderUniform1i(textureUniformName, 0);
glBindTexture(GL_TEXTURE_2D, (*tex)->getTexID());
renderer.DrawVertexRenderStruct(mesh);
renderer.PopMatrix();
renderer.shaderManager.PopShader();
}
renderer.PopMatrix();
// Draw text on top (uses absolute coords, add anim offset manually)
if (textRenderer && !text.empty()) {
float cx = rect.x + rect.w / 2.0f + animOffsetX;
float cy = rect.y + rect.h / 2.0f + animOffsetY;
textRenderer->drawText(text, cx, cy, 1.0f, textCentered, color);
}
glEnable(GL_DEPTH_TEST);
}
void UiSlider::buildTrackMesh() {