Skip to content

Commit 7396c0b

Browse files
committed
Add touchingColor() with mask param to target handlers
1 parent eea2f63 commit 7396c0b

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

include/scratchcpp/ispritehandler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ class LIBSCRATCHCPP_EXPORT ISpriteHandler
9292

9393
/*! Used to check whether the sprite touches the given color. */
9494
virtual bool touchingColor(const Value &color) const = 0;
95+
96+
/*! Used to check whether the mask part of the sprite touches the given color. */
97+
virtual bool touchingColor(const Value &color, const Value &mask) const = 0;
9598
};
9699

97100
} // namespace libscratchcpp

include/scratchcpp/istagehandler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ class LIBSCRATCHCPP_EXPORT IStageHandler
6969

7070
/*! Used to check whether the stage touches the given color. */
7171
virtual bool touchingColor(const Value &color) const = 0;
72+
73+
/*! Used to check whether the mask part of the stage touches the given color. */
74+
virtual bool touchingColor(const Value &color, const Value &mask) const = 0;
7275
};
7376

7477
} // namespace libscratchcpp

test/mocks/spritehandlermock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ class SpriteHandlerMock : public ISpriteHandler
3838
MOCK_METHOD(bool, touchingClones, (const std::vector<Sprite *> &), (const, override));
3939
MOCK_METHOD(bool, touchingPoint, (double, double), (const, override));
4040
MOCK_METHOD(bool, touchingColor, (const Value &), (const, override));
41+
MOCK_METHOD(bool, touchingColor, (const Value &, const Value &), (const, override));
4142
};

test/mocks/stagehandlermock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ class StageHandlerMock : public IStageHandler
2929
MOCK_METHOD(bool, touchingClones, (const std::vector<Sprite *> &), (const, override));
3030
MOCK_METHOD(bool, touchingPoint, (double, double), (const, override));
3131
MOCK_METHOD(bool, touchingColor, (const Value &), (const, override));
32+
MOCK_METHOD(bool, touchingColor, (const Value &, const Value &), (const, override));
3233
};

0 commit comments

Comments
 (0)