Add multiple skin container & Fix #4891

This commit is contained in:
CodingJellyfish 2023-07-13 16:09:38 +08:00
parent 9443a66878
commit 8f596e29b3
3 changed files with 19 additions and 5 deletions

View File

@ -1119,7 +1119,7 @@ void Skin::drawProgressBarInScreen(SkinWidgetContainer* swc,
core::recti rect2 = rect; core::recti rect2 = rect;
rect2.LowerRightCorner.X -= (rect.getWidth()) rect2.LowerRightCorner.X -= (rect.getWidth())
- int(progress * rect.getWidth()); - int(progress * rect.getWidth());
drawBoxFromStretchableTexture(swc, rect2, drawBoxFromStretchableTexture(swc->m_next, rect2,
SkinConfig::m_render_params["progress::fill"], deactivated); SkinConfig::m_render_params["progress::fill"], deactivated);
} // drawProgress } // drawProgress

View File

@ -176,6 +176,8 @@ namespace GUIEngine
short m_skin_r, m_skin_g, m_skin_b; short m_skin_r, m_skin_g, m_skin_b;
SkinWidgetContainer *m_next;
SkinWidgetContainer() SkinWidgetContainer()
{ {
m_skin_dest_areas_inited = false; m_skin_dest_areas_inited = false;
@ -187,7 +189,16 @@ namespace GUIEngine
m_skin_r = -1; m_skin_r = -1;
m_skin_g = -1; m_skin_g = -1;
m_skin_b = -1; m_skin_b = -1;
m_next = nullptr;
} // SkinWidgetContainer } // SkinWidgetContainer
~SkinWidgetContainer()
{
if (m_next != nullptr)
{
delete m_next;
}
}
}; // class SkinWidgetContainer }; // class SkinWidgetContainer
// ======================================================================== // ========================================================================

View File

@ -32,6 +32,9 @@ using namespace irr;
ProgressBarWidget::ProgressBarWidget(bool show_label) : Widget(WTYPE_PROGRESS) ProgressBarWidget::ProgressBarWidget(bool show_label) : Widget(WTYPE_PROGRESS)
{ {
// A progress bar consists of two parts, so need two containers
m_next = new SkinWidgetContainer;
m_value = 0; m_value = 0;
m_target_value = 0; m_target_value = 0;
m_previous_value = 0; m_previous_value = 0;