Skip to content

Commit 550c242

Browse files
committed
Indent with 4 spaces
1 parent 25faf38 commit 550c242

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1939
-1947
lines changed

src/Gui/Button.cpp

+37-37
Original file line numberDiff line numberDiff line change
@@ -6,84 +6,84 @@ namespace gui
66

77
Button::Button(const sf::String& string)
88
{
9-
m_box.item().setFont(Theme::getFont());
10-
m_box.item().setCharacterSize(Theme::textSize);
11-
m_box.setSize(Theme::minWidgetWidth, Theme::getBoxHeight());
12-
setString(string);
13-
setSize(m_box.getSize());
9+
m_box.item().setFont(Theme::getFont());
10+
m_box.item().setCharacterSize(Theme::textSize);
11+
m_box.setSize(Theme::minWidgetWidth, Theme::getBoxHeight());
12+
setString(string);
13+
setSize(m_box.getSize());
1414
}
1515

1616

1717
void Button::setString(const sf::String& string)
1818
{
19-
m_box.item().setString(string);
20-
21-
// Recompute widget width
22-
int fittingWidth = m_box.item().getLocalBounds().width + Theme::PADDING * 2 + Theme::borderSize * 2;
23-
int width = std::max(fittingWidth, Theme::minWidgetWidth);
24-
m_box.setSize(width, Theme::getBoxHeight());
25-
m_box.centerText(m_box.item());
26-
setSize(m_box.getSize());
19+
m_box.item().setString(string);
20+
21+
// Recompute widget width
22+
int fittingWidth = m_box.item().getLocalBounds().width + Theme::PADDING * 2 + Theme::borderSize * 2;
23+
int width = std::max(fittingWidth, Theme::minWidgetWidth);
24+
m_box.setSize(width, Theme::getBoxHeight());
25+
m_box.centerText(m_box.item());
26+
setSize(m_box.getSize());
2727
}
2828

2929

3030
const sf::String& Button::getString() const
3131
{
32-
return m_box.item().getString();
32+
return m_box.item().getString();
3333
}
3434

3535

3636
void Button::draw(sf::RenderTarget& target, sf::RenderStates states) const
3737
{
38-
states.transform *= getTransform();
39-
target.draw(m_box, states);
38+
states.transform *= getTransform();
39+
target.draw(m_box, states);
4040
}
4141

4242
// Callbacks -------------------------------------------------------------------
4343

4444
void Button::onStateChanged(State state)
4545
{
46-
m_box.applyState(state);
46+
m_box.applyState(state);
4747
}
4848

4949

5050
void Button::onMouseMoved(float x, float y)
5151
{
52-
if (getState() == StatePressed)
53-
{
54-
if (containsPoint(sf::Vector2f(x, y)))
55-
m_box.press();
56-
else
57-
m_box.release();
58-
}
52+
if (getState() == StatePressed)
53+
{
54+
if (containsPoint(sf::Vector2f(x, y)))
55+
m_box.press();
56+
else
57+
m_box.release();
58+
}
5959
}
6060

6161

6262
void Button::onMouseReleased(float x, float y)
6363
{
64-
if (containsPoint({x, y}))
65-
{
66-
triggerCallback();
67-
}
64+
if (containsPoint({x, y}))
65+
{
66+
triggerCallback();
67+
}
6868
}
6969

7070

7171
void Button::onKeyPressed(sf::Keyboard::Key key)
7272
{
73-
if (key == sf::Keyboard::Return)
74-
{
75-
triggerCallback();
76-
m_box.press();
77-
}
73+
if (key == sf::Keyboard::Return)
74+
{
75+
triggerCallback();
76+
m_box.press();
77+
}
7878
}
7979

8080

8181
void Button::onKeyReleased(sf::Keyboard::Key key)
8282
{
83-
if (key == sf::Keyboard::Return)
84-
{
85-
m_box.release();
86-
}
83+
if (key == sf::Keyboard::Return)
84+
{
85+
m_box.release();
86+
}
8787
}
8888

8989
}

src/Gui/Button.hpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ namespace gui
1414
class Button: public Widget
1515
{
1616
public:
17-
Button(const sf::String& string);
17+
Button(const sf::String& string);
1818

19-
/**
20-
* Set the displayed button label
21-
*/
22-
void setString(const sf::String& string);
19+
/**
20+
* Set the displayed button label
21+
*/
22+
void setString(const sf::String& string);
2323

24-
const sf::String& getString() const;
24+
const sf::String& getString() const;
2525

26-
// callbacks ---------------------------------------------------------------
26+
// callbacks ---------------------------------------------------------------
2727

28-
void onStateChanged(State state);
29-
void onMouseMoved(float x, float y);
30-
void onMouseReleased(float x, float y);
31-
void onKeyPressed(sf::Keyboard::Key key);
32-
void onKeyReleased(sf::Keyboard::Key key);
28+
void onStateChanged(State state) override;
29+
void onMouseMoved(float x, float y) override;
30+
void onMouseReleased(float x, float y) override;
31+
void onKeyPressed(sf::Keyboard::Key key) override;
32+
void onKeyReleased(sf::Keyboard::Key key) override;
3333

3434
private:
35-
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
35+
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
3636

37-
ItemBox<sf::Text> m_box;
37+
ItemBox<sf::Text> m_box;
3838
};
3939

4040
}

src/Gui/CheckBox.cpp

+26-26
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,64 @@ namespace gui
55
{
66

77
CheckBox::CheckBox(bool checked):
8-
m_box(Box::Input)
8+
m_box(Box::Input)
99
{
10-
int offset = Theme::PADDING + Theme::borderSize;
11-
float box_size = m_cross.getSize().x + offset * 2;
12-
m_box.setSize(box_size, box_size);
13-
m_cross.setPosition(offset, offset);
14-
m_cross.setColor(Theme::input.textColor);
15-
check(checked);
16-
17-
setSize(m_box.getSize());
10+
int offset = Theme::PADDING + Theme::borderSize;
11+
float box_size = m_cross.getSize().x + offset * 2;
12+
m_box.setSize(box_size, box_size);
13+
m_cross.setPosition(offset, offset);
14+
m_cross.setColor(Theme::input.textColor);
15+
check(checked);
16+
17+
setSize(m_box.getSize());
1818
}
1919

2020

2121
bool CheckBox::isChecked() const
2222
{
23-
return m_checked;
23+
return m_checked;
2424
}
2525

2626

2727
void CheckBox::check(bool checked)
2828
{
29-
m_checked = checked;
29+
m_checked = checked;
3030
}
3131

3232

3333
void CheckBox::draw(sf::RenderTarget& target, sf::RenderStates states) const
3434
{
35-
states.transform *= getTransform();
36-
target.draw(m_box, states);
37-
if (m_checked)
38-
target.draw(m_cross, states);
35+
states.transform *= getTransform();
36+
target.draw(m_box, states);
37+
if (m_checked)
38+
target.draw(m_cross, states);
3939
}
4040

4141
// callbacks -------------------------------------------------------------------
4242

4343
void CheckBox::onStateChanged(State state)
4444
{
45-
m_box.applyState(state);
45+
m_box.applyState(state);
4646
}
4747

4848

4949
void CheckBox::onMouseReleased(float x, float y)
5050
{
51-
if (containsPoint(sf::Vector2f(x, y)))
52-
{
53-
check(!m_checked);
54-
triggerCallback();
55-
}
51+
if (containsPoint(sf::Vector2f(x, y)))
52+
{
53+
check(!m_checked);
54+
triggerCallback();
55+
}
5656
}
5757

5858

5959
void CheckBox::onKeyPressed(sf::Keyboard::Key key)
6060
{
61-
if (key == sf::Keyboard::Space)
62-
{
63-
check(!m_checked);
64-
triggerCallback();
65-
}
61+
if (key == sf::Keyboard::Space)
62+
{
63+
check(!m_checked);
64+
triggerCallback();
65+
}
6666
}
6767

6868
}

src/Gui/CheckBox.hpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ namespace gui
1515
class CheckBox: public Widget
1616
{
1717
public:
18-
CheckBox(bool checked = false);
18+
CheckBox(bool checked = false);
1919

20-
bool isChecked() const;
20+
bool isChecked() const;
2121

22-
void check(bool checked);
22+
void check(bool checked);
2323

24-
// callbacks ---------------------------------------------------------------
24+
// callbacks ---------------------------------------------------------------
2525

26-
void onStateChanged(State state);
27-
void onMouseReleased(float x, float y);
28-
void onKeyPressed(sf::Keyboard::Key key);
26+
void onStateChanged(State state) override;
27+
void onMouseReleased(float x, float y) override;
28+
void onKeyPressed(sf::Keyboard::Key key) override;
2929

3030
private:
31-
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
31+
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
3232

33-
Box m_box;
34-
Cross m_cross;
35-
bool m_checked;
33+
Box m_box;
34+
Cross m_cross;
35+
bool m_checked;
3636
};
3737

3838
}

src/Gui/ComboBox.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ template <class T>
1818
class ComboBox
1919
{
2020
public:
21-
ComboBox();
21+
ComboBox();
2222

2323
private:
24-
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
24+
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
2525
};
2626

2727
}

src/Gui/Gui.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@
1919
#include "Layouts/VBoxLayout.hpp"
2020

2121
#endif // GUI_GUI_HPP
22-

src/Gui/Image.cpp

+23-23
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,50 @@ namespace gui
44
{
55

66
Image::Image():
7-
m_texture(NULL)
7+
m_texture(NULL)
88
{
9-
setSelectable(false);
9+
setSelectable(false);
1010
}
1111

1212

1313
Image::Image(const sf::Texture& texture):
14-
m_texture(NULL)
14+
m_texture(NULL)
1515
{
16-
setSelectable(false);
17-
setTexture(texture);
16+
setSelectable(false);
17+
setTexture(texture);
1818
}
1919

2020

2121
void Image::setTexture(const sf::Texture& texture)
2222
{
23-
int width = texture.getSize().x;
24-
int height = texture.getSize().y;
25-
m_vertices[0].position = m_vertices[0].texCoords = sf::Vector2f(0, 0);
26-
m_vertices[1].position = m_vertices[1].texCoords = sf::Vector2f(0, height);
27-
m_vertices[2].position = m_vertices[2].texCoords = sf::Vector2f(width, height);
28-
m_vertices[3].position = m_vertices[3].texCoords = sf::Vector2f(width, 0);
29-
m_texture = &texture;
30-
31-
// Set widget dimensions
32-
setSize(width, height);
23+
int width = texture.getSize().x;
24+
int height = texture.getSize().y;
25+
m_vertices[0].position = m_vertices[0].texCoords = sf::Vector2f(0, 0);
26+
m_vertices[1].position = m_vertices[1].texCoords = sf::Vector2f(0, height);
27+
m_vertices[2].position = m_vertices[2].texCoords = sf::Vector2f(width, height);
28+
m_vertices[3].position = m_vertices[3].texCoords = sf::Vector2f(width, 0);
29+
m_texture = &texture;
30+
31+
// Set widget dimensions
32+
setSize(width, height);
3333
}
3434

3535

3636
void Image::setColor(const sf::Color& color)
3737
{
38-
for (int i = 0; i < 4; ++i)
39-
m_vertices[i].color = color;
38+
for (int i = 0; i < 4; ++i)
39+
m_vertices[i].color = color;
4040
}
4141

4242

4343
void Image::draw(sf::RenderTarget& target, sf::RenderStates states) const
4444
{
45-
if (m_texture != NULL)
46-
{
47-
states.transform *= getTransform();
48-
states.texture = m_texture;
49-
target.draw(m_vertices, 4, sf::Quads, states);
50-
}
45+
if (m_texture != NULL)
46+
{
47+
states.transform *= getTransform();
48+
states.texture = m_texture;
49+
target.draw(m_vertices, 4, sf::Quads, states);
50+
}
5151
}
5252

5353
}

0 commit comments

Comments
 (0)