Don Miguel said:
Er... u're wrong, i think 8)
Am I wrong that the scene is dying, or am I wrong hoping the F200 will rejuvenate it ? Or am I wrong thinking that I have not given up ? You are probably right - story of my life.
I think I have squashed the bug by rewriting the collision detection( for the 20th odd time). There has not been much to say lately, since it has just been a matter of adding new objects, sticking them in the object list and slapping in appropriate handling functions.
The player has five lives to start and the game ends when these are used up. A score is being accumulated, but there is no way to tell these things since no text output is implemented. Luckily I have manged to salvage a text function from the G&W Fire code:
CODE
void drawGraphicTextStr(SDL_Surface *screen, char string[], Sint16 x, Sint16 y, int iColour) {
int iLen = strlen(string);
SDL_Rect fontLocation = { 0, 0, 16, 16};
SDL_Rect textLocation = { x, y, 16, 16};
SDL_Rect putLocation;
int pos=0;
int val;
// select the colour requested
switch(iColour) {
case TXT_RED:
fontLocation.y = 0;
break;
case TXT_YELLOW:
fontLocation.y = 16;
break;
case TXT_BLUE:
fontLocation.y = 32;
break;
case TXT_GREEN:
fontLocation.y = 48;
break;
}
for(pos = 0; pos < iLen; pos++){
val = string[pos] - 32;
fontLocation.x = val * 16;
putLocation = textLocation;
SDL_BlitSurface(fontgfx, &fontLocation, screen, &putLocation);
textLocation.x += 16;
}
}
It takes a surface to display on, a string, the co-ordinates and a colour as its parameters.
This requires a bitmap image of the font pointed to by fontgfx. The image has four copies of the font, arranged in ascii order, each made a different colour, placed one above the other. I have added a colour selection option that simply changes the Y offset by the height of the characters to point to the requested colour.
I had a bit of trouble with this that is worth a mention. It seems that SDL alters the the contents of the destination rectangle if the blit is not fully on screen. I had no idea it did this and was getting odd results as I assumed it was constant and was relying on it for positioning the characters. To circumvent this I have added a copy of the destination rectangle that SDL can destroy without losing my information.
Now that this is functioning, the score and lives can be displayed. Also messages and a menu can be added. Maybe even a high score table.