Skip to content

Commit

Permalink
add default cases / fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightmare82 committed Nov 13, 2023
1 parent 2b37a20 commit e209db0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions imgui-SFML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,10 @@ void ProcessEvent(const sf::Event& event) {
static_cast<float>(event.mouseMove.y));
s_currWindowCtx->mouseMoved = true;
break;
default:
break;
}

if (s_currWindowCtx->windowIsHovered) {

switch (event.type) {
Expand All @@ -324,18 +326,17 @@ void ProcessEvent(const sf::Event& event) {
io.MouseWheelH += event.mouseWheelScroll.delta;
}
break;

default:
break;
}
}

if (s_currWindowCtx->windowHasFocus)
{
if (s_currWindowCtx->windowHasFocus) {
switch (event.type) {
case sf::Event::MouseButtonPressed: // fall-through
case sf::Event::MouseButtonReleased: {
const int button = event.mouseButton.button;
if (button >= 0 && button < 3)
{
if (button >= 0 && button < 3) {
if (event.type == sf::Event::MouseButtonPressed)
{
io.AddMouseButtonEvent(button, true);
Expand Down Expand Up @@ -440,8 +441,7 @@ void Update(const sf::Vector2i& mousePos, const sf::Vector2f& displaySize, sf::T
io.DeltaTime = dt.asSeconds();

if (s_currWindowCtx->windowIsHovered ||
s_currWindowCtx->windowHasFocus)
{
s_currWindowCtx->windowHasFocus) {
if (io.WantSetMousePos) {
const sf::Vector2i newMousePos(static_cast<int>(io.MousePos.x),
static_cast<int>(io.MousePos.y));
Expand Down

0 comments on commit e209db0

Please sign in to comment.