MCPcopy Create free account
hub / github.com/Cpasjuste/pplay / Highlight

Method Highlight

src/highlight.cpp:12–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace c2d;
11
12Highlight::Highlight(const c2d::Vector2f &size, const CursorPosition &pos) : Rectangle(size) {
13
14 gradientRectangle = new GradientRectangle({0, 0, size.x, size.y});
15 gradientRectangle->setColor(COLOR_HIGHLIGHT, Color::Transparent,
16 pos == CursorPosition::Left ? GradientRectangle::Direction::Right
17 : GradientRectangle::Direction::Left);
18 Highlight::add(gradientRectangle);
19
20 cursor = new RectangleShape(Vector2f{6, size.y});
21 cursor->setFillColor(COLOR_BLUE);
22 if (pos == CursorPosition::Right) {
23 cursor->move(size.x - 4, 0);
24 }
25 Highlight::add(cursor);
26
27 tween = new TweenPosition(Highlight::getPosition(),
28 Highlight::getPosition(), (float) INPUT_DELAY / 2);
29 tween->setState(TweenState::Stopped);
30 Highlight::add(tween);
31}
32
33void Highlight::setAlpha(uint8_t alpha, bool /*recursive*/) {
34 if (alpha <= COLOR_HIGHLIGHT.a) {

Callers

nothing calls this directly

Calls 1

setFillColorMethod · 0.45

Tested by

no test coverage detected