Nintendo 3DS >> C/C++

Pixels


參考資訊:
1. libctru doc
2. 3ds-examples

說明:

API
void gfxSetDoubleBuffering(gfxScreen_t screen, bool enable)
u8* gfxGetFramebuffer(gfxScreen_t screen, gfx3dSide_t side, u16 *width, u16 *height)
void gfxFlushBuffers(void)

main.c

#include <3ds.h>
#include <stdio.h>
#include <string.h>

int main(void)
{
    u8 *fb = NULL;
    int x = 0, y = 0;

    gfxInitDefault();
    gfxSetDoubleBuffering(GFX_BOTTOM, false);

    fb = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
    for (y=0; y<240; y++) {
        for (x=0; x<320; x++) {
            fb[0] = 0x00;
            fb[1] = 0x00;
            fb[2] = 0xff;
            fb+= 3;
        }
    }

    gfxFlushBuffers();
    gfxSwapBuffers();
    gspWaitForVBlank();
    svcSleepThread(3000000000LL);
    gfxExit();
    return 0;
}

完成


返回上一頁