Fixed compiler warnings and coding style issues.
This commit is contained in:
@@ -37,12 +37,13 @@ ProgressBarWidget::ProgressBarWidget(bool show_label) : Widget(WTYPE_PROGRESS)
|
||||
m_previous_value = 0;
|
||||
m_show_label = show_label;
|
||||
setFocusable(false);
|
||||
}
|
||||
} // ProgressBarWidget
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
ProgressBarWidget::~ProgressBarWidget()
|
||||
{
|
||||
GUIEngine::needsUpdate.remove(this);
|
||||
}
|
||||
} // ~ProgressBarWidget
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -50,7 +51,9 @@ void ProgressBarWidget::add()
|
||||
{
|
||||
rect<s32> widget_size = rect<s32>(m_x, m_y, m_x + m_w, m_y + m_h);
|
||||
stringw& message = m_text;
|
||||
m_element = GUIEngine::getGUIEnv()->addButton(widget_size, m_parent, getNewNoFocusID(), message.c_str(), L"");
|
||||
m_element = GUIEngine::getGUIEnv()->addButton(widget_size, m_parent,
|
||||
getNewNoFocusID(),
|
||||
message.c_str(), L"");
|
||||
|
||||
m_id = m_element->getID();
|
||||
m_element->setTabStop(false);
|
||||
@@ -62,7 +65,7 @@ void ProgressBarWidget::add()
|
||||
\brief animate the element and its children.
|
||||
*/
|
||||
GUIEngine::needsUpdate.push_back(this);
|
||||
}
|
||||
} // add
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -73,7 +76,7 @@ void ProgressBarWidget::setValue(int value)
|
||||
m_previous_value = value;
|
||||
if (m_show_label)
|
||||
setLabel(std::string(StringUtils::toString(value) + "%").c_str());
|
||||
}
|
||||
} // setValue
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -83,7 +86,7 @@ void ProgressBarWidget::moveValue(int value)
|
||||
m_target_value = value;
|
||||
if (m_show_label)
|
||||
setLabel(std::string(StringUtils::toString(value) + "%").c_str());
|
||||
}
|
||||
} // moveValue
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -92,14 +95,16 @@ void ProgressBarWidget::update(float delta)
|
||||
if (m_target_value != m_value)
|
||||
{
|
||||
// Compute current progress in the animation
|
||||
float cur = (static_cast<float>(m_value) - m_previous_value) / (m_target_value - m_previous_value);
|
||||
float cur = (static_cast<float>(m_value) - m_previous_value)
|
||||
/ (m_target_value - m_previous_value);
|
||||
// Animation time: 1.0 seconds
|
||||
cur += delta * 10;
|
||||
if (cur > 1)
|
||||
cur = 1;
|
||||
m_value = m_previous_value + cur * (m_target_value - m_previous_value);
|
||||
m_value = int(m_previous_value +
|
||||
cur * (m_target_value - m_previous_value) );
|
||||
}
|
||||
}
|
||||
} // update
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -107,7 +112,7 @@ void ProgressBarWidget::setLabel(irr::core::stringw label)
|
||||
{
|
||||
m_element->setText( label.c_str() );
|
||||
m_text = label;
|
||||
}
|
||||
} // setLabel
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user