hello,
I wanted to create some homebrew for a while now, so i started learning c(++). Now I am at the point where I understand most of it, and i got a good working menu(and the 3ds).
But now i wanted to draw a single pixel on the 3ds bottom screen, and the troubles start, as both the location and color are off. I am using the following code(which i found on several homebrew apps).
i call this function with a for loop, so it should draw a diagonal line in the screen (starting at 1,1). But Here is where it is getting weird, The first diagonal line starts at 1,1, is yellow. the second line starts halfway down the y as and is blue, the third line starts at a quarter of the x as and is blue too (all lines stop halfway at the x as).
can someone explain what I am missing here(my guess is at the screen getframebuffer, but i cant get what).
thanks in advance.
I wanted to create some homebrew for a while now, so i started learning c(++). Now I am at the point where I understand most of it, and i got a good working menu(and the 3ds).
But now i wanted to draw a single pixel on the 3ds bottom screen, and the troubles start, as both the location and color are off. I am using the following code(which i found on several homebrew apps).
(I know this code can be much shorter, but i wrote a lot out as i try to solve this problem.void drawpixel(int i)
{
u8* screen;
screen = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
char r= 0xff;
char g= 0x00;
char b = 0x00;
int height = 240;
u32 v = (height-1-i+i*height)*3;
screen[v] = b;
screen[v + 1] = g;
screen[v + 2] = r;
}
i call this function with a for loop, so it should draw a diagonal line in the screen (starting at 1,1). But Here is where it is getting weird, The first diagonal line starts at 1,1, is yellow. the second line starts halfway down the y as and is blue, the third line starts at a quarter of the x as and is blue too (all lines stop halfway at the x as).
can someone explain what I am missing here(my guess is at the screen getframebuffer, but i cant get what).
thanks in advance.