Exemple #1
0
static void drawMenu(Menu* const m)
{
    a_pixel_setClip(false);

    const int h = a_sprite_h(sprites.menu[0]) + 2;
    int y = 4 + a_sprite_h(sprites.large) + 4;

    A_MENU_ITERATE(m, Item, item) {
        if(a_menu_isSelected(m, item)) {
            item->alpha = a_math_min(item->alpha + 32, 255);
        } else {
            item->alpha = a_math_max(item->alpha - 32, 0);
        }

        a_pixel_setBlend(A_PIXEL_PLAIN);
        a_blit(sprites.menu[0], 4, y);

        a_pixel_setBlend(A_PIXEL_RGBA);
        a_pixel_setAlpha(item->alpha);
        a_blit(sprites.menu[1], 4, y);

        a_pixel_setBlend(A_PIXEL_PLAIN);
        a_font_text(A_LEFT, 12, y + 5, fonts.whiteBold, item->text);

        y += h;
    }
}
Exemple #2
0
static void drawTitle(void)
{
    a_pixel_setBlend(A_PIXEL_PLAIN);
    a_pixel_setClip(false);

    a_blit(sprites.large, 4, 4);
    a_font_text(A_LEFT, 12, 12, fonts.orange, currentTask);

    char title[64];
    sprintf(title, "%s %s", a2x_str("app.title"), a2x_str("app.version"));

    a_font_text(A_RIGHT, a_width - 12, 12, fonts.whiteBold, title);
    a_font_text(A_RIGHT, a_width - 12, 12, fonts.grayBold, a2x_str("app.version"));
}
Exemple #3
0
static void drawDryRun(int alone)
{
    a_pixel_setBlend(A_PIXEL_PLAIN);
    a_pixel_setClip(false);

    const int y = alone
        ? a_height - 1 - 4 - a_sprite_h(sprites.small)
        : a_height - 1 - 4 - a_sprite_h(sprites.large) - 2 - a_sprite_h(sprites.small);

    a_blit(sprites.small, 4, y);

    int x = a_font_text(A_LEFT, 12, y + 5, fonts.white, "Safety ");

    if(ini_dryRun()) {
        x = a_font_text(A_LEFT, x, y + 5, fonts.whiteBold, "ON");
        a_font_text(A_LEFT, x, y + 5, fonts.white, " - Files will not be written");
    } else {
        x = a_font_text(A_LEFT, x, y + 5, fonts.whiteBold, "OFF");
        a_font_text(A_LEFT, x, y + 5, fonts.white, " - Files will be written");
    }
}
Exemple #4
0
static void drawControls(void)
{
    a_pixel_setBlend(A_PIXEL_PLAIN);
    a_pixel_setClip(false);

    int x;
    const int y = a_height - 1 - 4 - a_sprite_h(sprites.large);

    a_blit(sprites.large, 4, y);

    x = a_font_text(A_LEFT, 12, y + 8, fonts.white, "B");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.blue, " select");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.green, " / ");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.white, "X");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.blue, " cancel ");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.green, " / ");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.white, "MENU");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.blue, " exit");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.green, " / ");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.white, "SELECT");
    x = a_font_text(A_LEFT, x,  y + 8, fonts.blue, " toggle safety");
}
Exemple #5
0
static void a_blit_test(void) {
	printsln((String)__func__);
	Array s, d, e;

	s = ia_range(1, 10);
	d = ia_create(5, 0);
	a_blit(s, 0, d, 0, 5);
	e = ia_of_string("1 2 3 4 5");
	ia_check_expect(d, e);
	a_free(s);
	a_free(d);
	a_free(e);

	s = ia_range(1, 10);
	d = ia_create(5, 0);
	a_blit(s, 0, d, 1, 4);
	e = ia_of_string("0 1 2 3 4");
	ia_check_expect(d, e);
	a_free(s);
	a_free(d);
	a_free(e);

	s = ia_range(1, 10);
	d = ia_create(5, 0);
	a_blit(s, 0, d, 1, 3);
	e = ia_of_string("0 1 2 3 0");
	ia_check_expect(d, e);
	a_free(s);
	a_free(d);
	a_free(e);

	s = ia_range(1, 10);
	d = ia_create(5, 0);
	a_blit(s, 0, d, 0, 0);
	e = ia_of_string("0 0 0 0 0");
	ia_check_expect(d, e);
	a_free(s);
	a_free(d);
	a_free(e);

	s = ia_range(1, 10);
	d = ia_create(5, 0);
	a_blit(s, 1, d, 0, 3);
	e = ia_of_string("2 3 4 0 0");
	ia_check_expect(d, e);
	a_free(s);
	a_free(d);
	a_free(e);

	s = da_range(1, 10, 1);
	d = da_create(5, 0);
	a_blit(s, 0, d, 0, 5);
	e = da_of_string("1 2 3 4 5");
	da_check_within(d, e);
	a_free(s);
	a_free(d);
	a_free(e);

	s = da_range(1, 10, 1);
	d = da_create(5, 0);
	a_blit(s, 0, d, 1, 4);
	e = da_of_string("0 1 2 3 4");
	da_check_within(d, e);
	a_free(s);
	a_free(d);
	a_free(e);

	s = da_range(1, 10, 1);
	d = da_create(5, 0);
	a_blit(s, 0, d, 1, 3);
	e = da_of_string("0 1 2 3 0");
	da_check_within(d, e);
	a_free(s);
	a_free(d);
	a_free(e);

	s = da_range(1, 10, 1);
	d = da_create(5, 0);
	a_blit(s, 0, d, 0, 0);
	e = da_of_string("0 0 0 0 0");
	da_check_within(d, e);
	a_free(s);
	a_free(d);
	a_free(e);

	s = da_range(1, 10, 1);
	d = da_create(5, 0);
	a_blit(s, 1, d, 0, 3);
	e = da_of_string("2 3 4 0 0");
	da_check_within(d, e);
	a_free(s);
	a_free(d);
	a_free(e);
}