BRESULT menubase_open(int num) { MENUBASE *mb; SCRNMENU smenu; VRAMHDL hdl; mb = &menubase; menubase_close(); if (scrnmng_entermenu(&smenu) != SUCCESS) { goto mbopn_err; } mb->width = smenu.width; mb->height = smenu.height; mb->bpp = smenu.bpp; hdl = vram_create(mb->width, mb->height, TRUE, smenu.bpp); menuvram = hdl; if (hdl == NULL) { goto mbopn_err; } unionrect_rst(&mb->rect); mb->num = num; return(SUCCESS); mbopn_err: return(FAILURE); }
BOOL vramdraw_create(void) { SYS_T *sys; VRAMHDL v; sys = &gamecore.sys; #ifndef SIZE_QVGA v = vram_create(sys->width, sys->height, FALSE, DEFAULT_BPP); #else v = vram_create(320, 240, FALSE, DEFAULT_BPP); #endif mainvram = v; if (v == NULL) { TRACEOUT(("couldn't create mainvram")); return(FAILURE); } // vram 0と1は最初から開いてます… #ifndef SIZE_QVGA gamecore.vram[0] = vram_create(sys->width, sys->height, TRUE, DEFAULT_BPP); gamecore.vram[1] = vram_create(sys->width, sys->height, TRUE, DEFAULT_BPP); #else gamecore.vram[0] = vram_create(320, 240, TRUE, DEFAULT_BPP); gamecore.vram[1] = vram_create(320, 240, TRUE, DEFAULT_BPP); #endif unionrect_rst(&gamecore.vramrect); return(SUCCESS); }
void vramdraw_draw(void) { UNIRECT *unirect; const RECT_T *rect; unirect = &gamecore.vramrect; if (unirect->type) { rect = unionrect_get(unirect); vramdraw_drawvram(mainvram, rect); scrnmng_draw(rect); unionrect_rst(unirect); } }
void menubase_draw(void (*draw)(VRAMHDL dst, const RECT_T *rect, void *arg), void *arg) { MENUBASE *mb; const RECT_T *rect; mb = &menubase; if (mb->rect.type) { rect = unionrect_get(&mb->rect); if (draw) { draw(menuvram, rect, arg); } scrnmng_menudraw(rect); unionrect_rst(&mb->rect); } }