Beispiel #1
0
void Starfield::draw() const {
    const RgbColor slowColor   = GetRGBTranslateColorShade(kStarColor, MEDIUM);
    const RgbColor mediumColor = GetRGBTranslateColorShade(kStarColor, LIGHT);
    const RgbColor fastColor   = GetRGBTranslateColorShade(kStarColor, LIGHTER);

    switch (g.ship.get() ? g.ship->presenceState : kNormalPresence) {
        default:
            if (!_warp_stars) {
                Points points;
                // we're not warping in any way
                for (const scrollStarType* star : range(_stars, _stars + kScrollStarNum)) {
                    if (star->speed != kNoStar) {
                        const RgbColor* color = &slowColor;
                        if (star->speed == kMediumStarSpeed) {
                            color = &mediumColor;
                        } else if (star->speed == kFastStarSpeed) {
                            color = &fastColor;
                        }

                        points.draw(star->location, *color);
                    }
                }
                break;
            }

        case kWarpInPresence:
        case kWarpOutPresence:
        case kWarpingPresence: {
            Lines lines;
            for (const scrollStarType* star : range(_stars, _stars + kScrollStarNum)) {
                if (star->speed != kNoStar) {
                    const RgbColor* color = &slowColor;
                    if (star->speed == kMediumStarSpeed) {
                        color = &mediumColor;
                    } else if (star->speed == kFastStarSpeed) {
                        color = &fastColor;
                    }

                    if (star->age > 1) {
                        lines.draw(star->location, star->oldLocation, *color);
                    }
                }
            }
            break;
        }
    }

    Points points;
    for (const scrollStarType* star : range(_stars + kSparkStarOffset, _stars + kAllStarNum)) {
        if ((star->speed != kNoStar) && (star->age > 0)) {
            const RgbColor color =
                    GetRGBTranslateColorShade(star->hue, (star->age >> kSparkAgeToShadeShift) + 1);
            points.draw(star->location, color);
        }
    }
}
Beispiel #2
0
void HintLine::draw() {
    if (show_hint_line) {
        Lines lines;
        Point start = hint_line_start;
        Point end = hint_line_end;

        start.offset(0, 2);
        end.offset(0, 2);
        lines.draw(start, end, hint_line_color_dark);

        start.offset(0, -1);
        end.offset(0, -1);
        lines.draw(start, end, hint_line_color);

        start.offset(0, -1);
        end.offset(0, -1);
        lines.draw(start, end, hint_line_color);
    }
}