I changed to a 16 bit blitter which fixed the non-transparent issues. Sound effects are also implemented, but only one can be played at a time and starting a new sound effects stops the last one. Music is not implemented, as midi is the only supported music format. There also is no documented way of creating a sound buffer that can notify the game when more sound data is needed.
The new version can be downloaded from the same location:
Thanks to AleMaxx and Triple Oxygen for their code. The Sunplus port was developed using libgame and based on the keydemo sources, and Triple Oxygen’s audio demo.
I added the following to the gfx_types.h header file to create a 16 bit bitmap:
#define IMG_TYPE_16BPP 0
… created the bitmap using:
uint8_t bitmapID; gfx_loadimg_t loadImg; uint16_t pImageBuffer = new uint16_t[SCREENWIDTH * SCREENHEIGHT]; loadImg.data = pImageBuffer; loadImg.width = SCREENWIDTH; loadImg.height = SCREENHEIGHT; loadImg.img_type = IMG_TYPE_16BPP; loadImg.unk2 = 0; loadImg.pal_data = NULL; loadImg.pal_size = 0; loadImg.unk3 = 0x80; gfx_load_image(&loadImg, &bitmapID);
… and blitted the bitmap to the screen using:
gfx_point2d_t pos; gfx_rect_t rect; pos.x = 0; pos.y = 0; rect.x = 0; rect.y = 0; rect.width = SCREENWIDTH; rect.height = SCREENHEIGHT; gfx_set_colorrop(COLOR_ROP_TRANSP); gfx_bitblt(bitmapID, &rect, &pos); gfx_flush(); gfx_paint();
The created 16 bit buffer is in RGB565 format, where:
Full red is 0xF800
Full green is 0x07E0
Full blue is 0x001F
And white is 0xFFFF
Pingback: DOOM port and homebrew gamedev on SPMP8000 - Page 32