Example #1
0
void HintLine::show(Point fromWhere, Point toWhere, uint8_t color, uint8_t brightness) {
    hint_line_start = fromWhere;
    hint_line_end = toWhere;
    show_hint_line = true;

    hint_line_color = GetRGBTranslateColorShade(color, brightness);
    hint_line_color_dark = GetRGBTranslateColorShade(color, VERY_DARK);
}
Example #2
0
ObjectDataScreen::ObjectDataScreen(
        Point origin, const BaseObject& object, Trigger trigger, int mouse, Key key,
        Gamepad::Button gamepad)
        : _trigger(trigger), _mouse(mouse), _key(key), _gamepad(gamepad), _state(TYPING) {
    pn::string text;
    CreateObjectDataText(text, object);
    _text.reset(new StyledText(sys.fonts.button));
    _text->set_fore_color(GetRGBTranslateColorShade(Hue::GREEN, LIGHTEST));
    _text->set_back_color(GetRGBTranslateColorShade(Hue::GREEN, DARKEST));
    _text->set_retro_text(text);
    _text->wrap_to(kShipDataWidth, 0, 0);
    _bounds = object_data_bounds(origin, Size(_text->auto_width(), _text->height()));
}
Example #3
0
void draw_text_in_rect(Rect tRect, pn::string_view text, InterfaceStyle style, Hue hue) {
    RgbColor   color = GetRGBTranslateColorShade(hue, LIGHTEST);
    StyledText interface_text(interface_font(style));
    interface_text.set_fore_color(color);
    interface_text.set_interface_text(text);
    interface_text.wrap_to(tRect.width(), kInterfaceTextHBuffer, kInterfaceTextVBuffer);
    tRect.offset(0, -kInterfaceTextVBuffer);
    interface_text.draw(tRect);
}
Example #4
0
void ObjectDataScreen::draw() const {
    next()->draw();
    Rect outside = _bounds;
    outside.inset(-8, -4);
    const RgbColor light_green = GetRGBTranslateColorShade(Hue::GREEN, LIGHTEST);
    Rects().fill(outside, light_green);
    outside.inset(1, 1);
    Rects().fill(outside, RgbColor::black());
    _text->draw_range(_bounds, 0, _typed_chars);
    if (_typed_chars < _text->size()) {
        _text->draw_cursor(_bounds, _typed_chars);
    }
}
Example #5
0
void LoadingScreen::overlay() const {
    Rect above_content(0, 0, 640, 480);
    above_content.center_in(world());
    above_content.bottom = item(0).bounds().top;
    Rect bounds(0, 0, _name_text->auto_width(), _name_text->height());
    bounds.center_in(above_content);

    _name_text->draw_range(bounds, 0, _chars_typed);
    if (_chars_typed < _name_text->size()) {
        _name_text->draw_cursor(bounds, _chars_typed);
    }

    const RgbColor& light = GetRGBTranslateColorShade(kLoadingScreenColor, LIGHT);
    const RgbColor& dark  = GetRGBTranslateColorShade(kLoadingScreenColor, DARK);
    Point           off   = offset();
    Rect            bar   = item(0).bounds();
    bar.offset(off.h, off.v);
    Rects rects;
    rects.fill(bar, dark);
    bar.right = bar.left + (bar.width() * _current / _max);
    rects.fill(bar, light);
}
Example #6
0
void SelectLevelScreen::draw_level_name() const {
    const String chapter_name((*_level)->name);

    const InterfaceItem& i = item(NAME);

    RgbColor   color = GetRGBTranslateColorShade(AQUA, VERY_LIGHT);
    StyledText retro(sys.fonts.title);
    retro.set_fore_color(color);
    retro.set_retro_text(chapter_name);
    retro.wrap_to(440, 0, 2);

    Rect  bounds = i.bounds();
    Point off    = offset();
    bounds.offset(off.h, off.v);
    retro.draw(bounds);
}
Example #7
0
LoadingScreen::LoadingScreen(Handle<Level> level, bool* cancelled)
        : InterfaceScreen("loading", {0, 0, 640, 480}, true),
          _state(TYPING),
          _level(level),
          _cancelled(cancelled),
          _next_update(now() + kTypingDelay),
          _chars_typed(0),
          _current(0),
          _max(1) {
    StringList strings(kLevelNameID);
    _name_text.reset(new StyledText(sys.fonts.title));
    _name_text->set_fore_color(GetRGBTranslateColorShade(PALE_GREEN, VERY_LIGHT));
    _name_text->set_retro_text(strings.at(_level->levelNameStrNum - 1));
    _name_text->set_tab_width(220);
    _name_text->wrap_to(640, 0, 2);
}
Example #8
0
void DebriefingScreen::draw() const {
    next()->draw();
    Rects().fill(_pix_bounds, RgbColor::black());
    if (_score) {
        _score->draw_range(_score_bounds, 0, _typed_chars);
    }
    Rect interface_bounds = _message_bounds;
    interface_bounds.offset(_pix_bounds.left, _pix_bounds.top);
    draw_interface_item(_data_item, KEYBOARD_MOUSE);

    draw_text_in_rect(interface_bounds, _message, kLarge, GOLD);

    RgbColor bracket_color  = GetRGBTranslateColorShade(GOLD, VERY_LIGHT);
    Rect     bracket_bounds = _score_bounds;
    bracket_bounds.inset(-2, -2);
    draw_vbracket(Rects(), bracket_bounds, bracket_color);
}
Example #9
0
void GameCursor::draw() const {
    if (!show) {
        return;
    }

    Point where = sys.video->get_mouse();

    where = clamp(where);
    if (active()) {
        const Rect clip_rect = viewport();
        const RgbColor color = GetRGBTranslateColorShade(SKY_BLUE, MEDIUM);

        Point top_a = Point(where.h, clip_rect.top);
        Point top_b = Point(where.h, (where.v - kCursorBoundsSize));
        Point bottom_a = Point(where.h, (where.v + kCursorBoundsSize));
        Point bottom_b = Point(where.h, clip_rect.bottom - 1);
        Point left_a = Point(clip_rect.left, where.v);
        Point left_b = Point((where.h - kCursorBoundsSize), where.v);
        Point right_a = Point(std::max(viewport().left, where.h + kCursorBoundsSize), where.v);
        Point right_b = Point(clip_rect.right - 1, where.v);

        Rects rects;
        if (top_a.h >= viewport().left) {
            rects.fill({top_a.h, top_a.v, top_b.h + 1, top_b.v + 1}, color);
            rects.fill({bottom_a.h, bottom_a.v, bottom_b.h + 1, bottom_b.v + 1}, color);
        }
        rects.fill({right_a.h, right_a.v, right_b.h + 1, right_b.v + 1}, color);
        if (left_b.h >= viewport().left) {
            rects.fill({left_a.h, left_a.v, left_b.h + 1, left_b.v + 1}, color);
        }
    }

    if (where.h < viewport().left) {
        draw_at(where);
    }
}
Example #10
0
RgbColor GetRGBTranslateColorShade(uint8_t color, uint8_t shade) {
    RgbColor result;
    GetRGBTranslateColorShade(&result, color, shade);
    return result;
}