示例#1
0
static int score_card(const char  *title,
                      const float *c0,
                      const float *c1)
{
    int id, jd, kd, ld;

    int p1 = (curr_party() >= 1) ? 1 : 0, l1 = (curr_party() == 1) ? 1 : 0;
    int p2 = (curr_party() >= 2) ? 1 : 0, l2 = (curr_party() == 2) ? 1 : 0;
    int p3 = (curr_party() >= 3) ? 1 : 0, l3 = (curr_party() == 3) ? 1 : 0;
    int p4 = (curr_party() >= 4) ? 1 : 0, l4 = (curr_party() == 4) ? 1 : 0;

    int i;
    int n = curr_count() - 1;
    int m = curr_count() / 2;

    if ((id = gui_vstack(0)))
    {
        gui_label(id, title, GUI_MED, GUI_ALL, c0, c1);
        gui_space(id);

        if ((jd = gui_hstack(id)))
        {
            if ((kd = gui_varray(jd)))
            {
                if (p1) gui_label(kd, _("O"),         0, GUI_NE, 0, 0);
                if (p1) gui_label(kd, hole_out(0), 0, 0,           gui_wht, gui_wht);
                if (p1) gui_label(kd, hole_out(1), 0, GUI_SE * l1, gui_red, gui_wht);
                if (p2) gui_label(kd, hole_out(2), 0, GUI_SE * l2, gui_grn, gui_wht);
                if (p3) gui_label(kd, hole_out(3), 0, GUI_SE * l3, gui_blu, gui_wht);
                if (p4) gui_label(kd, hole_out(4), 0, GUI_SE * l4, gui_yel, gui_wht);
            }

            if ((kd = gui_harray(jd)))
                for (i = m; i > 0; i--)
                    if ((ld = gui_varray(kd)))
                    {
                        if (p1) gui_label(ld, number(i), 0, (i == 1) ? GUI_NW : 0, 0, 0);
                        if (p1) gui_label(ld, hole_score(i, 0), 0, 0, gui_wht, gui_wht);
                        if (p1) gui_label(ld, hole_score(i, 1), 0, 0, gui_red, gui_wht);
                        if (p2) gui_label(ld, hole_score(i, 2), 0, 0, gui_grn, gui_wht);
                        if (p3) gui_label(ld, hole_score(i, 3), 0, 0, gui_blu, gui_wht);
                        if (p4) gui_label(ld, hole_score(i, 4), 0, 0, gui_yel, gui_wht);
                    }
            if ((kd = gui_varray(jd)))
            {
                gui_filler(kd);
                if (p1) gui_label(kd, _("Par"), 0, GUI_NW,      gui_wht, gui_wht);
                if (p1) gui_label(kd, _("P1"),  0, GUI_SW * l1, gui_red, gui_wht);
                if (p2) gui_label(kd, _("P2"),  0, GUI_SW * l2, gui_grn, gui_wht);
                if (p3) gui_label(kd, _("P3"),  0, GUI_SW * l3, gui_blu, gui_wht);
                if (p4) gui_label(kd, _("P4"),  0, GUI_SW * l4, gui_yel, gui_wht);
            }
        }

        gui_space(id);

        if ((jd = gui_hstack(id)))
        {
            if ((kd = gui_varray(jd)))
            {
                if (p1) gui_label(kd, _("Tot"),    0, GUI_TOP, 0, 0);
                if (p1) gui_label(kd, hole_tot(0), 0, 0,           gui_wht, gui_wht);
                if (p1) gui_label(kd, hole_tot(1), 0, GUI_BOT * l1, gui_red, gui_wht);
                if (p2) gui_label(kd, hole_tot(2), 0, GUI_BOT * l2, gui_grn, gui_wht);
                if (p3) gui_label(kd, hole_tot(3), 0, GUI_BOT * l3, gui_blu, gui_wht);
                if (p4) gui_label(kd, hole_tot(4), 0, GUI_BOT * l4, gui_yel, gui_wht);
            }
            if ((kd = gui_varray(jd)))
            {
                if (p1) gui_label(kd, _("I"),     0, GUI_NE, 0, 0);
                if (p1) gui_label(kd, hole_in(0), 0, 0,           gui_wht, gui_wht);
                if (p1) gui_label(kd, hole_in(1), 0, GUI_SE * l1, gui_red, gui_wht);
                if (p2) gui_label(kd, hole_in(2), 0, GUI_SE * l2, gui_grn, gui_wht);
                if (p3) gui_label(kd, hole_in(3), 0, GUI_SE * l3, gui_blu, gui_wht);
                if (p4) gui_label(kd, hole_in(4), 0, GUI_SE * l4, gui_yel, gui_wht);
            }
            if ((kd = gui_harray(jd)))
                for (i = n; i > m; i--)
                    if ((ld = gui_varray(kd)))
                    {
                        if (p1) gui_label(ld, number(i), 0, (i == m+1) ? GUI_NW : 0, 0, 0);
                        if (p1) gui_label(ld, hole_score(i, 0), 0, 0, gui_wht, gui_wht);
                        if (p1) gui_label(ld, hole_score(i, 1), 0, 0, gui_red, gui_wht);
                        if (p2) gui_label(ld, hole_score(i, 2), 0, 0, gui_grn, gui_wht);
                        if (p3) gui_label(ld, hole_score(i, 3), 0, 0, gui_blu, gui_wht);
                        if (p4) gui_label(ld, hole_score(i, 4), 0, 0, gui_yel, gui_wht);
                    }
            if ((kd = gui_varray(jd)))
            {
                gui_filler(kd);
                if (p1) gui_label(kd, _("Par"), 0, GUI_NW,      gui_wht, gui_wht);
                if (p1) gui_label(kd, _("P1"),  0, GUI_SW * l1, gui_red, gui_wht);
                if (p2) gui_label(kd, _("P2"),  0, GUI_SW * l2, gui_grn, gui_wht);
                if (p3) gui_label(kd, _("P3"),  0, GUI_SW * l3, gui_blu, gui_wht);
                if (p4) gui_label(kd, _("P4"),  0, GUI_SW * l4, gui_yel, gui_wht);
            }
        }

        gui_layout(id, 0, 0);
    }

    return id;
}
示例#2
0
文件: st_all.c 项目: Aeggy/neverball
static int score_card(const char  *title,
                      const GLubyte *c0,
                      const GLubyte *c1)
{
    int id, jd, kd, ld;

    int p1 = (curr_party() >= 1) ? 1 : 0;
    int p2 = (curr_party() >= 2) ? 1 : 0;
    int p3 = (curr_party() >= 3) ? 1 : 0;
    int p4 = (curr_party() >= 4) ? 1 : 0;

    int i;
    int n = curr_count() - 1;
    int m = curr_count() / 2;

    if ((id = gui_vstack(0)))
    {
        gui_label(id, title, GUI_MED, c0, c1);
        gui_space(id);

        if ((jd = gui_hstack(id)))
        {
            if ((kd = gui_varray(jd)))
            {
                if (p1) gui_label(kd, _("O"),      0, 0, 0);
                if (p1) gui_label(kd, hole_out(0), 0, gui_wht, gui_wht);
                if (p1) gui_label(kd, hole_out(1), 0, gui_red, gui_wht);
                if (p2) gui_label(kd, hole_out(2), 0, gui_grn, gui_wht);
                if (p3) gui_label(kd, hole_out(3), 0, gui_blu, gui_wht);
                if (p4) gui_label(kd, hole_out(4), 0, gui_yel, gui_wht);

                gui_set_rect(kd, GUI_RGT);
            }

            if ((kd = gui_harray(jd)))
            {
                for (i = m; i > 0; i--)
                    if ((ld = gui_varray(kd)))
                    {
                        if (p1) gui_label(ld, number(i), 0, 0, 0);
                        if (p1) gui_label(ld, hole_score(i, 0), 0, gui_wht, gui_wht);
                        if (p1) gui_label(ld, hole_score(i, 1), 0, gui_red, gui_wht);
                        if (p2) gui_label(ld, hole_score(i, 2), 0, gui_grn, gui_wht);
                        if (p3) gui_label(ld, hole_score(i, 3), 0, gui_blu, gui_wht);
                        if (p4) gui_label(ld, hole_score(i, 4), 0, gui_yel, gui_wht);
                    }

                gui_set_rect(kd, GUI_LFT);
            }

            if ((kd = gui_vstack(jd)))
            {
                gui_space(kd);

                if ((ld = gui_varray(kd)))
                {
                    if (p1) gui_label(ld, _("Par"), 0, gui_wht, gui_wht);
                    if (p1) gui_label(ld, _("P1"),  0, gui_red, gui_wht);
                    if (p2) gui_label(ld, _("P2"),  0, gui_grn, gui_wht);
                    if (p3) gui_label(ld, _("P3"),  0, gui_blu, gui_wht);
                    if (p4) gui_label(ld, _("P4"),  0, gui_yel, gui_wht);

                    gui_set_rect(ld, GUI_ALL);
                }
            }
        }

        gui_space(id);

        if ((jd = gui_hstack(id)))
        {
            if ((kd = gui_varray(jd)))
            {
                if (p1) gui_label(kd, _("Tot"),    0, 0, 0);
                if (p1) gui_label(kd, hole_tot(0), 0, gui_wht, gui_wht);
                if (p1) gui_label(kd, hole_tot(1), 0, gui_red, gui_wht);
                if (p2) gui_label(kd, hole_tot(2), 0, gui_grn, gui_wht);
                if (p3) gui_label(kd, hole_tot(3), 0, gui_blu, gui_wht);
                if (p4) gui_label(kd, hole_tot(4), 0, gui_yel, gui_wht);

                gui_set_rect(kd, GUI_ALL);
            }

            if ((kd = gui_varray(jd)))
            {
                if (p1) gui_label(kd, _("I"),     0, 0, 0);
                if (p1) gui_label(kd, hole_in(0), 0, gui_wht, gui_wht);
                if (p1) gui_label(kd, hole_in(1), 0, gui_red, gui_wht);
                if (p2) gui_label(kd, hole_in(2), 0, gui_grn, gui_wht);
                if (p3) gui_label(kd, hole_in(3), 0, gui_blu, gui_wht);
                if (p4) gui_label(kd, hole_in(4), 0, gui_yel, gui_wht);

                gui_set_rect(kd, GUI_RGT);
            }

            if ((kd = gui_harray(jd)))
            {
                for (i = n; i > m; i--)
                    if ((ld = gui_varray(kd)))
                    {
                        if (p1) gui_label(ld, number(i), 0, 0, 0);
                        if (p1) gui_label(ld, hole_score(i, 0), 0, gui_wht, gui_wht);
                        if (p1) gui_label(ld, hole_score(i, 1), 0, gui_red, gui_wht);
                        if (p2) gui_label(ld, hole_score(i, 2), 0, gui_grn, gui_wht);
                        if (p3) gui_label(ld, hole_score(i, 3), 0, gui_blu, gui_wht);
                        if (p4) gui_label(ld, hole_score(i, 4), 0, gui_yel, gui_wht);
                    }

                gui_set_rect(kd, GUI_LFT);
            }

            if ((kd = gui_vstack(jd)))
            {
                gui_space(kd);

                if ((ld = gui_varray(kd)))
                {
                    if (p1) gui_label(ld, _("Par"), 0, gui_wht, gui_wht);
                    if (p1) gui_label(ld, _("P1"),  0, gui_red, gui_wht);
                    if (p2) gui_label(ld, _("P2"),  0, gui_grn, gui_wht);
                    if (p3) gui_label(ld, _("P3"),  0, gui_blu, gui_wht);
                    if (p4) gui_label(ld, _("P4"),  0, gui_yel, gui_wht);

                    gui_set_rect(ld, GUI_ALL);
                }
            }
        }

        gui_layout(id, 0, 0);
    }

    return id;
}