Skip to content

Commit b222c40

Browse files
committed
Remove unnecessary braces
1 parent d9f4825 commit b222c40

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

imgui-SFML.cpp

+1-22
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,9 @@ bool Init(sf::Window& window, const sf::Vector2f& displaySize, bool loadDefaultF
334334
loadMouseCursor(ImGuiMouseCursor_Hand, sf::Cursor::Type::Hand);
335335

336336
if (loadDefaultFont)
337-
{
338337
// this will load default font automatically
339338
// No need to call AddDefaultFont
340339
return UpdateFontTexture();
341-
}
342340

343341
return true;
344342
}
@@ -403,13 +401,9 @@ void ProcessEvent(const sf::Window& window, const sf::Event& event)
403401
{
404402
if (mouseWheelScrolled->wheel == sf::Mouse::Wheel::Vertical ||
405403
(mouseWheelScrolled->wheel == sf::Mouse::Wheel::Horizontal && io.KeyShift))
406-
{
407404
io.AddMouseWheelEvent(0, mouseWheelScrolled->delta);
408-
}
409405
else if (mouseWheelScrolled->wheel == sf::Mouse::Wheel::Horizontal)
410-
{
411406
io.AddMouseWheelEvent(mouseWheelScrolled->delta, 0);
412-
}
413407
}
414408
const auto handleKeyChanged = [&io](const auto& keyChanged, bool down)
415409
{
@@ -513,13 +507,10 @@ void Update(const sf::Vector2i& mousePos, const sf::Vector2f& displaySize, sf::T
513507
if (s_currWindowCtx->windowHasFocus)
514508
{
515509
if (io.WantSetMousePos)
516-
{
517510
sf::Mouse::setPosition(sf::Vector2i(toSfVector2f(io.MousePos)));
518-
}
519511
else
520-
{
521512
io.MousePos = toImVec2(sf::Vector2f(mousePos));
522-
}
513+
523514
for (unsigned int i = 0; i < 3; i++)
524515
{
525516
io.MouseDown[i] = s_currWindowCtx->touchDown[i] || sf::Touch::isDown(i) ||
@@ -633,9 +624,7 @@ bool UpdateFontTexture()
633624

634625
sf::Texture newTexture;
635626
if (!newTexture.resize(sf::Vector2u(sf::Vector2(width, height))))
636-
{
637627
return false;
638-
}
639628

640629
newTexture.update(pixels);
641630

@@ -943,9 +932,7 @@ void RenderDrawLists(ImDrawData* draw_data)
943932
{
944933
ImGui::GetDrawData();
945934
if (draw_data->CmdListsCount == 0)
946-
{
947935
return;
948-
}
949936

950937
const ImGuiIO& io = ImGui::GetIO();
951938
assert(io.Fonts->TexID != (ImTextureID) nullptr); // You forgot to create and set font texture
@@ -1115,9 +1102,7 @@ void updateJoystickButtonState(ImGuiIO& io)
11151102
const bool isPressed = sf::Joystick::isButtonPressed(s_currWindowCtx->joystickId.value(),
11161103
static_cast<unsigned>(i));
11171104
if (s_currWindowCtx->windowHasFocus || !isPressed)
1118-
{
11191105
io.AddKeyEvent(key, isPressed);
1120-
}
11211106
}
11221107
}
11231108
}
@@ -1126,18 +1111,12 @@ void updateJoystickAxis(ImGuiIO& io, ImGuiKey key, sf::Joystick::Axis axis, floa
11261111
{
11271112
float pos = sf::Joystick::getAxisPosition(s_currWindowCtx->joystickId.value(), axis);
11281113
if (inverted)
1129-
{
11301114
pos = -pos;
1131-
}
11321115
const bool passedThreshold = (pos > threshold) == (maxThreshold > threshold);
11331116
if (passedThreshold && s_currWindowCtx->windowHasFocus)
1134-
{
11351117
io.AddKeyAnalogEvent(key, true, std::abs(pos / 100.f));
1136-
}
11371118
else
1138-
{
11391119
io.AddKeyAnalogEvent(key, false, 0);
1140-
}
11411120
}
11421121

11431122
void updateJoystickAxisPair(ImGuiIO& io, ImGuiKey key1, ImGuiKey key2, sf::Joystick::Axis axis, float threshold, bool inverted)

0 commit comments

Comments
 (0)