#include <3ds.h>
#include <stdio.h>
void drawPixelTopRGBFramebuffer(u8 *fb, int x, int y, u8 r, u8 g, u8 b) {
y = 240 - y;
x = x;
u32 v = (y + x * 240) * 3;
fb[v] = r;
fb[v + 1] = g;
fb[v + 2] = b;
}
int main(int argc, char **argv) {
gfxInitDefault();
gfxSetDoubleBuffering(GFX_TOP, false);
gfxSetDoubleBuffering(GFX_BOTTOM, false);
consoleInit(GFX_BOTTOM, NULL);
gfxFlushBuffers();
gfxSwapBuffers();
printf("test"); // this text is mangled
u8 *framebuffer = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
int i = 0;
for(i = 0; i < 10; i++) {
drawPixelTopRGBFramebuffer(framebuffer, i, i, 255, 255, 255);
}
while(aptMainLoop()) {
hidScanInput();
u32 kDown = hidKeysDown();
if(kDown & KEY_START) break;
gspWaitForVBlank();
}
gfxExit();
return 0;
}