This is an old revision of the document!


Racing game

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;
Screenshot from game
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);
en/projects/racing_game.1276458442.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0