Skip to content

Commit d91d7b3

Browse files
committed
Added way of deactivating mouse walls when a game in on.
No logger logging Server Tasks.
1 parent e7b702a commit d91d7b3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Examples/ExampleMother/ExampleMother.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ struct MouseWallConfig
201201
((int32_t), y1, 0),
202202
((int32_t), x2, 5760),
203203
((int32_t), y2, 2062),
204-
((float), borderBreakSeconds, 0.5f)
204+
((float), borderBreakSeconds, 0.5f),
205+
((bool), deactivateOnGame, false)
205206
)
206207

207208
bool isMouseInArea(int32_t mouseX, int32_t mouseY) const
@@ -581,7 +582,6 @@ class MyGame : public bbe::Game
581582
if (!seenServerTaskIds.getList().contains({ id }))
582583
{
583584
bbe::String task = line.substring(separator + 1, -1);
584-
BBELOGLN(task);
585585
tasks.addServerTask(id, task);
586586
seenServerTaskIds.add({ id });
587587
}
@@ -599,7 +599,7 @@ class MyGame : public bbe::Game
599599
}
600600

601601
beginMeasure("Mouse Wall");
602-
if (mouseWallConfig->active)
602+
if (mouseWallConfig->active && (!processes.isGameOn() || !mouseWallConfig->deactivateOnGame))
603603
{
604604
bbe::Vector2 globalMouse = getMouseGlobal();
605605
if (mouseWallConfig->mouseTrapped)
@@ -1122,7 +1122,7 @@ class MyGame : public bbe::Game
11221122
}
11231123
errorString = "";
11241124
}
1125-
catch (const nlohmann::json::parse_error& e)
1125+
catch (const nlohmann::json::parse_error&)
11261126
{
11271127
errorString = bbe::String("Failed to interpret json: ") + contents.dataContainer.getRaw();
11281128
}
@@ -1376,6 +1376,8 @@ class MyGame : public bbe::Game
13761376
bool requiresWrite = false;
13771377

13781378
requiresWrite |= ImGui::Checkbox("Active", &mouseWallConfig->active);
1379+
ImGui::Text((processes.isGameOn() && mouseWallConfig->deactivateOnGame) ? "Deactivated because of game!" : "");
1380+
requiresWrite |= ImGui::Checkbox("Deactives on game", &mouseWallConfig->deactivateOnGame);
13791381
requiresWrite |= ImGui::InputInt("X1", &mouseWallConfig->x1);
13801382
requiresWrite |= ImGui::InputInt("Y1", &mouseWallConfig->y1);
13811383
requiresWrite |= ImGui::InputInt("X2", &mouseWallConfig->x2);

0 commit comments

Comments
 (0)