Digital Awakening
Member
Didn't seem to be much traffic at the other board I tried so I'm hoping for a reply here instead.
With Sol's tutorial as base I've started working on an image draw function, not that hard really. It's still very basic but I got an alpha color key coded in so I get transparency. Now the problem is when I want to use this function on another image. I really don't know how to do that so if someone could help me I would be quite happy. In case anyone wonders I'm using images the size of the screen at the moment, gonna make adjustments for that later. Getting this function to work as I want should be pretty much all I need to develop for GP2X, at least for now.
With Sol's tutorial as base I've started working on an image draw function, not that hard really. It's still very basic but I got an alpha color key coded in so I get transparency. Now the problem is when I want to use this function on another image. I really don't know how to do that so if someone could help me I would be quite happy. In case anyone wonders I'm using images the size of the screen at the moment, gonna make adjustments for that later. Getting this function to work as I want should be pretty much all I need to develop for GP2X, at least for now.
Code:
void drawimage(int x, int y)
{
// Lock surface if needed
if (SDL_MUSTLOCK(gFG))
if (SDL_LockSurface(gFG) < 0)
return;
int i, j;
for (i = 0; i < WIDTH; i++)
{
int screenofs = x + (y + i) * PITCH;
for (j = 0; j < WIDTH; j++)
{
if ( ((unsigned int*)gFG->pixels)[screenofs] != 0xffffff ) {
((unsigned int*)gScreen->pixels)[screenofs] =
((unsigned int*)gFG->pixels)[screenofs];
}
screenofs++;
}
}
// Unlock if needed
if (SDL_MUSTLOCK(gFG))
SDL_UnlockSurface(gFG);
}