Skip to content

Commit

Permalink
Update ProgressBar Code Style
Browse files Browse the repository at this point in the history
updates Progress Bar's code style.
  • Loading branch information
Hapaxia committed Feb 20, 2025
1 parent 5741e1a commit 42c1e14
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/SelbaWard/ProgressBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ ProgressBar::ProgressBar(const sf::Vector2f size)
: m_amount{ 0.f }
, m_showBar{ true }
, m_showBackground{ false }
, m_size(size)
, m_color(sf::Color::White)
, m_size{ size }
, m_color{ sf::Color::White }
, m_bar(4u)
, m_backgroundAndFrame(size)
, m_texture{ nullptr }
, m_backgroundTexture{ nullptr }
, m_textureRectangle()
, m_backgroundTextureRectangle()
, m_textureRectangle{}
, m_backgroundTextureRectangle{}
{
m_backgroundAndFrame.setFillColor(sf::Color::Black);
m_backgroundAndFrame.setOutlineColor(sf::Color::White);
Expand Down Expand Up @@ -110,8 +110,8 @@ void ProgressBar::setTexture(const sf::Texture& texture, const bool resetRect)
m_texture = &texture;
if (resetRect)
{
m_textureRectangle.size.x = m_texture->getSize().x;
m_textureRectangle.size.y = m_texture->getSize().y;
m_textureRectangle.size.x = static_cast<int>(m_texture->getSize().x);
m_textureRectangle.size.y = static_cast<int>(m_texture->getSize().y);
}
priv_updateGraphics();
}
Expand All @@ -133,8 +133,8 @@ void ProgressBar::setBackgroundTexture(const sf::Texture& backgroundTexture, con
m_backgroundTexture = &backgroundTexture;
if (resetRect)
{
m_backgroundTextureRectangle.size.x = m_backgroundTexture->getSize().x;
m_backgroundTextureRectangle.size.y = m_backgroundTexture->getSize().y;
m_backgroundTextureRectangle.size.x = static_cast<int>(m_backgroundTexture->getSize().x);
m_backgroundTextureRectangle.size.y = static_cast<int>(m_backgroundTexture->getSize().y);
}
priv_updateGraphics();
}
Expand Down Expand Up @@ -163,10 +163,10 @@ const sf::Texture& ProgressBar::getBackgroundTexture() const

sf::FloatRect ProgressBar::getLocalBounds() const
{
if (m_showBackground && m_backgroundAndFrame.getOutlineThickness() > 0.f)
if (m_showBackground && (m_backgroundAndFrame.getOutlineThickness() > 0.f))
{
const float outlineThickness{ m_backgroundAndFrame.getOutlineThickness() };
return{ { 0.f - outlineThickness, 0.f - outlineThickness }, { m_size.x + outlineThickness * 2, m_size.y + outlineThickness * 2 } };
return{ { 0.f - outlineThickness, 0.f - outlineThickness }, { m_size.x + outlineThickness * 2.f, m_size.y + outlineThickness * 2f } };
}
else
return{ { 0.f, 0.f }, m_size };
Expand Down Expand Up @@ -203,7 +203,7 @@ void ProgressBar::draw(sf::RenderTarget& target, sf::RenderStates states) const
if (m_showBar)
{
states.texture = m_texture;
target.draw(&m_bar.front(), 4u, sf::PrimitiveType::TriangleStrip, states);
target.draw(m_bar.data(), 4u, sf::PrimitiveType::TriangleStrip, states);
}
}

Expand Down

0 comments on commit 42c1e14

Please sign in to comment.