This is an old revision of the document!
This racing game is a demonstration of using ARM-CAN UserInterface module to display 2D graphics on the LCD and use the joystick. The game itself is very simple – user has to drive the car on the track as fast as possible. There are no opponents nor obstacles on the track
The program is made of several C source files which each take care of different tasks. The main function resides in “racing_game.c”.
typedef struct { short sX; short sY; } tPoint; typedef struct { tPoint pPosition; unsigned short usRadius; } tTrackSection; typedef struct { short sRadius; unsigned long ulAngle; } tPolarPoint; typedef struct { long lVelocity; long lSteering; tPoint pPosition; unsigned long ulAngle; unsigned long ulColor; unsigned long ulLapTime; tBoolean bOnFinishLine; } tCar;
int main(void); void DoCarDriving(tCar *pCar); void PrepareCar(void);
void GrPolyDraw(const tContext *pContext, const tPoint *pPoints, unsigned long ulNumPoints, unsigned char ucClosedLoop); void GrPolyFill(const tContext *pContext, const tPoint *pPoints, unsigned long ulNumPoints);