Exemple #1
0
void scoreboard_render_overlay(scene *scene) {
    scoreboard_local *local = scene_get_userdata(scene);
    video_render_sprite_size(&local->black_surface, 0, 0, 320, 200);
    char row[128];
    char score_text[15];
    char temp_name[17];
    const char* score_row_format = "%-18s%-9s%-9s%11s";

    // Header text
    sprintf(row, "SCOREBOARD - %s", round_get_name(local->page));
    int title_x = 62 + (local->page == 0 ? 8 : 0);
    font_render(&font_large, row, title_x, 5, TEXT_COLOR_HEADER);

    // Column names
    sprintf(row, score_row_format, "PLAYER NAME", "ROBOT", "PILOT", "SCORE");
    font_render(&font_small, row, 20, 20, TEXT_COLOR_HEADER);

    // Scores information
    unsigned int score, har_id, pilot_id;
    char *player_name;
    int entry = 0;
    int found_slot = 0;
    for(int r = 0; r < 20; r++) {
        score = local->data.entries[local->page][entry].score;
        row[0] = 0;

        // If this slot is the slot where the new, pending score data should be written,
        // show pending data and text input field. Otherwise just show next line of 
        // original saved score data.
        if(local->has_pending_data && score < local->pending_data.score && !found_slot) {
            sprintf(temp_name, "%s%s", local->pending_data.name, CURSOR_STR);
            score_format(local->pending_data.score, score_text);
            sprintf(row,
                score_row_format,
                temp_name,
                har_get_name(local->pending_data.har_id),
                pilot_get_name(local->pending_data.pilot_id),
                score_text);
            found_slot = 1;
        } else {
            har_id = local->data.entries[local->page][entry].har_id;
            pilot_id = local->data.entries[local->page][entry].pilot_id;
            player_name = local->data.entries[local->page][entry].name;
            if(score > 0) {
                score_format(score, score_text);
                sprintf(row,
                    score_row_format,
                    player_name,
                    har_get_name(har_id),
                    pilot_get_name(pilot_id),
                    score_text);
            }
            entry++;
        }
        font_render(&font_small, row, 20, 30 + r*8, TEXT_COLOR_SCORES);
    }
}
Exemple #2
0
void newsroom_overlay_render(scene *scene) {
    newsroom_local *local = scene_get_userdata(scene);

    // Render screencapture
    har_screencaps *caps = &(game_state_get_player(scene->gs, (local->won ? 0 : 1))->screencaps);
    if(local->screen == 0) {
        if(caps->ok[SCREENCAP_POSE])
            video_render_sprite_size(&caps->cap[SCREENCAP_POSE], 165, 15, SCREENCAP_W, SCREENCAP_H);
    } else {
        if(caps->ok[SCREENCAP_BLOW])
            video_render_sprite_size(&caps->cap[SCREENCAP_BLOW], 165, 15, SCREENCAP_W, SCREENCAP_H);
    }

    // Render text
    if(str_size(&local->news_str) > 0) {
        video_render_sprite(&local->news_bg, 20, 140, BLEND_ALPHA, 0);
        font_render_wrapped(&font_small, str_c(&local->news_str), 30, 150, 250, COLOR_YELLOW);
    }

    // Dialog
    if(dialog_is_visible(&local->continue_dialog)) {
        dialog_render(&local->continue_dialog);
    }
}