MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / CheckCondition

Method CheckCondition

plugins/base/macro-condition-cursor.cpp:52–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52bool MacroConditionCursor::CheckCondition()
53{
54 bool ret = false;
55 const auto &[x, y] = GetCursorPos();
56 SetTempVarValue("x", std::to_string(x));
57 SetTempVarValue("y", std::to_string(y));
58
59 switch (_condition) {
60 case Condition::REGION:
61 ret = x >= _minX && y >= _minY && x <= _maxX && y <= _maxY;
62 SetVariableValue(std::to_string(x) + " " + std::to_string(y));
63 break;
64 case Condition::MOVING:
65 ret = x != _lastX || y != _lastY;
66 break;
67 case Condition::CLICK:
68 ret = CheckClick();
69 break;
70 }
71
72 _lastCheckTime = std::chrono::high_resolution_clock::now();
73 _lastX = x;
74 _lastY = y;
75
76 if (GetVariableValue().empty()) {
77 SetVariableValue(ret ? "true" : "false");
78 }
79 return ret;
80}
81
82bool MacroConditionCursor::Save(obs_data_t *obj) const
83{

Callers

nothing calls this directly

Calls 5

GetCursorPosFunction · 0.85
SetTempVarValueFunction · 0.85
to_stringFunction · 0.85
nowClass · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected