#include <3ds.h>
#include "memory.h"
int main()
{
// Initialize services
srvInit();
aptInit();
hidInit(NULL);
gfxInit();
//gfxSet3D(true); // uncomment if using stereoscopic 3D
int x = 50;
int y = 50;
int R, G, B;
int numColour = 1;
char* a = "o";
// Main loop
while (aptMainLoop())
{
gspWaitForVBlank();
hidScanInput();
// Your code goes here
u32 kDown = hidKeysDown();
u32 kHeld = hidKeysHeld();
if (kDown & KEY_START) break; // break in order to return to hbmenu
// Example rendering code that displays some text
// Please note that the 3DS screens are sideways (thus 240x400 and 240x320)
u8* fb = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
memset(fb, 0, 240*400*3);
if (kHeld & KEY_DUP){
y++;
//y++;
//y++;
}
if (kHeld & KEY_DDOWN){
y--;
//y--;
//y--;
}
if (kHeld & KEY_DRIGHT){
x++;
//x++;
//x++;
}
if (kHeld & KEY_DLEFT){
x--;
//x--;
//x--;
}
/*========numColour: 0 = White, 1 = Red, 2 = Blue, 3 = Green, 4 = Yellow======== +1*/
if (kDown & KEY_R){ //Colours rotate right
numColour++;
if ((numColour = 6)){
numColour = 1;
}
}
if (kDown & KEY_L){ //Colours rotate left
numColour--;
if ((numColour = 0)){
numColour = 5;
}
}
if((numColour = 1)){ //White
R = 255;
G = 255;
B = 255;
paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
}
else if((numColour = 2)){ //Red
R = 255;
G = 0;
B = 0;
paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
}
else if((numColour = 3)){ //Blue
R = 0;
G = 0;
B = 255;
paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
}
else if((numColour = 4)){ //Green
R = 0;
G = 204;
B = 0;
paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
}
else if((numColour = 5)){ //Yellow
R = 255;
G = 255;
B = 0;
paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
}
paint_word(fb, a, x, y, 255, 255, 255);
// Flush and swap framebuffers
gfxFlushBuffers();
gfxSwapBuffers();
}
// Exit services
gfxExit();
hidExit();
aptExit();
srvExit();
return 0;
}