What am I doing wrong?
-
- Posts: 2
- Joined: Mon Apr 20, 2009 5:02 am
What am I doing wrong?
Okay, I know I'm screwing up somewhere along the line here, but I'm not sure where. Uploaded here is the source code for a test project I've created from bits and pieces of a few tutorials (primarily the Drunken Coders 8-bit bitmap tutorial) and my own version of a quick-and-dirty anti-aliased line algorithm, ported over from SDL. I'm basically tossing things together to see if I can figure out how this works, but I can't figure out where my code is going wrong in attempting to draw to a framebuffer and then copy to the screen. I seem to be using the same initializations and copying technique as the Drunken Coders example, but for whatever reason, their program is drawing to the screen, whereas mine is not. Am I overlooking something obvious here?
Re: What am I doing wrong?
You're using dmaCopy to copy the palette from the stack which isn't working. Simply change your palette code in initVideo() to:
Once that's done you should get lines on the screen.
Code: Select all
u16 *c = new u16[32];
for (u16 i = 0; i <= 31; i++)
{
c[i] = RGB15((u16)(i),(u16)(i * .75),0);
};
dmaCopy(c,BG_PALETTE, 64);
delete[] c;
-
- Posts: 2
- Joined: Mon Apr 20, 2009 5:02 am
Re: What am I doing wrong?
Ah. The palette seems a little off, but it works now. Thanks, things should be a lot easier to figure out with some working code to start from.
Re: What am I doing wrong?
Been thinking about this a little more and it's probably best to avoid dmaCopy for this unless you can guarantee the DMA transfer has completed before destroying the palette array. In the original example code the array is permanent so it's not time-critical. Since in your code it's just an initialisation function it will probably be easiest to use one of the other copy routines and bypass DMA completely.
Who is online
Users browsing this forum: No registered users and 0 guests