ECE2035 Spring 2015 TA / Mbed 2 deprecated 2035_Badminton_Shell

Dependencies:   4DGL-uLCD-SE EthernetInterface Game_Synchronizer MMA8452 SDFileSystem Sound mbed-rtos mbed wave_player

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers racket.h Source File

racket.h

00001 #ifndef RACKET_H_
00002 #define RACKET_H_
00003 
00004 #include "misc.h"
00005 
00006 typedef struct racket
00007 {
00008     int player;         // PLAYER1 or PLAYER2
00009     int x, y;           // center x and y positions
00010     int width, height;  // width and height of racket
00011     int x0, y0;         // initial positions before jump
00012     float vx0, vy0;     // initial velocities of racket
00013     float time_elapsed; // cumulative time in air
00014     bool has_jumped;    // if the player has jumped and is in the air
00015     int points;         // points per player
00016 } racket;
00017 
00018 // Initialize racket struct members. Int parameter identifies PLAYER1 or PLAYER2.
00019 void init_racket(racket*, int);
00020 
00021 // Helper function to bound each racket within its boundaries. Not necessary, but 
00022 // cleans up redundant code.
00023 void bound_x(racket*);
00024 
00025 // Calculates next position, both running and jumping, of racket using kinematic
00026 // equations.
00027 void update_racket(racket*, float);
00028 
00029 #endif