我需要将原始像素数据绘制到任天堂DS的“子”屏幕上,例如,如果我在“帧缓冲”模式或“扩展旋转”模式下绘制到主屏幕。如何使用当前版本的libnds (似乎对VRAM_C的使用进行了限制)来实现这一点?
发布于 2013-08-24 11:27:37
#include <nds.h>
int main(void)
{
int x, y;
//set the mode to allow for an extended rotation background
videoSetMode(MODE_5_2D);
videoSetModeSub(MODE_5_2D);
//allocate a vram bank for each display
vramSetBankA(VRAM_A_MAIN_BG);
vramSetBankC(VRAM_C_SUB_BG);
//create a background on each display
int bgMain = bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 0,0);
int bgSub = bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0,0);
u16* videoMemoryMain = bgGetGfxPtr(bgMain);
u16* videoMemorySub = bgGetGfxPtr(bgSub);
//initialize it with a color
for(x = 0; x < 256; x++)
for(y = 0; y < 256; y++)
{
videoMemoryMain[x + y * 256] = ARGB16(1, 31, 0, 0);
videoMemorySub[x + y * 256] = ARGB16(1, 0, 0, 31);
}
while(1)
{
swiWaitForVBlank();
}
}这是一个简单的例子,它在主屏幕和子屏幕上创建一个16位的帧缓冲区,并用红色或蓝色填充每个屏幕。
https://stackoverflow.com/questions/7536434
复制相似问题