From b03d543f0fdec08c05c0ee69cbbefe2f745a7507 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Tue, 16 Mar 2021 05:24:14 +0200 Subject: [PATCH 1/1] semi-transparent delete window --- src/gbaregs.h | 18 ++++++++++++++++++ src/main.c | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/gbaregs.h b/src/gbaregs.h index a85b814..e54e801 100644 --- a/src/gbaregs.h +++ b/src/gbaregs.h @@ -225,6 +225,24 @@ along with this program. If not, see . #define BGCNT_SZ_TX_512X512 BGCNT_SZ(3) #define BGCNT_SZ_RS_1024X1024 BGCNT_SZ(3) +/* REG_BLDCNT bits */ +#define BLDCNT_A_BG0 0x0001 +#define BLDCNT_A_BG1 0x0002 +#define BLDCNT_A_BG2 0x0004 +#define BLDCNT_A_BG3 0x0008 +#define BLDCNT_A_OBJ 0x0010 +#define BLDCNT_A_BACKDROP 0x0020 +#define BLDCNT_B_BG0 0x0100 +#define BLDCNT_B_BG1 0x0200 +#define BLDCNT_B_BG2 0x0400 +#define BLDCNT_B_BG3 0x0800 +#define BLDCNT_B_OBJ 0x1000 +#define BLDCNT_B_BACKDROP 0x2000 + +#define BLDCNT_ALPHA 0x0040 +#define BLDCNT_BRIGHTEN 0x0080 +#define BLDCNT_DARKEN 0x00c0 + /* REG_IF bits */ #define IF_VBLANK 0x0001 #define IF_HBLANK 0x0002 diff --git a/src/main.c b/src/main.c index af2f6d3..7dc1a99 100644 --- a/src/main.c +++ b/src/main.c @@ -117,6 +117,8 @@ int main(void) dma_copy16(3, fbptr[1], bgimg_pixels, 240 * 160 / 2, 0); init_sprites(); + REG_BLDCNT = BLDCNT_ALPHA | BLDCNT_B_BG2; + REG_BLDALPHA = 0x040c; xgl_init(); xgl_viewport(0, 0, 240, VP_HEIGHT); @@ -231,7 +233,8 @@ static void show_msgbox(int en) if(en) { for(i=0; i<3; i++) { - set_sprite(oam, SIDX_DEL0 + i, SNAM_DEL0 + i * 8, 42 + i * 64, 42, 0, SPR_SZ64); + set_sprite(oam, SIDX_DEL0 + i, SNAM_DEL0 + i * 8, 42 + i * 64, 50, 0, + SPR_SZ64 | SPR_BLEND); } } else { for(i=0; i<3; i++) { -- 1.7.10.4