Nintendo 3DS >> C/C++
Screen Tearing Test
參考資訊:
1. libctru doc
2. 3ds-examples
main.c
#include <3ds.h> #include <stdio.h> #include <string.h> int main(void) { u16 *fb = NULL; int x = 0, y = 0, z = 0; u16 col[] = {0xf800, 0x7e0, 0x1f}; gfxInitDefault(); gfxSetDoubleBuffering(GFX_TOP, true); gfxSetScreenFormat(GFX_TOP, GSP_RGB565_OES); while (z < 600) { fb = (u16 *)gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL); for (y=0; y<240; y++) { for (x=0; x<400; x++) { *fb++ = col[z % 3]; } } z+= 1; gfxFlushBuffers(); gfxSwapBuffers(); gspWaitForVBlank(); } gfxExit(); return 0; }
完成