| 50 | } |
| 51 | |
| 52 | bool 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 | |
| 82 | bool MacroConditionCursor::Save(obs_data_t *obj) const |
| 83 | { |
nothing calls this directly
no test coverage detected