Hi,
I programmed a simple snake line on my primer with freertos. This line gets longer when you drive with the joystick. My problem is that I what to get an Game Over when the snake touch itself. The snakes colour is red and the display is white. So I tried it with this code
in lcd.c
u16 LCD_GetPixel( u8 x, u8 y )
{
u16 val;
LCD_RectRead( x, y, 1, 1, (u8*)&val );
return val;
}
in main.c
if (LCD_GetPixel(wurm[idx].xs+4,wurm[idx].ys+4) != RGB_WHITE)
{
killWurm(idx, farbe, pcstring, &xMessage);
continue;
}
void killWurm(int idx, int farbe, char *pcString, xWurmMessage *xMessage) //Wenn der Wurm eine Wand berührt = Game Over
{
wurm[idx].len = -wurm[idx].len;
xMessage->dx=0;
xMessage->dy=0;
DRAW_SetTextColor(farbe);
DRAW_DisplayString( MSG_X, MSG_Y, pcString, strlen( pcString ));
}
char pcstring[15];
strcpy(pcstring,"GAME OVER");
the problem is when I start the game nothing happend. The snake doesn't move.I think that the LCD_GetPixel function doesn't work correct.you have ideas?
regards
breez