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 shuttle.h Source File

shuttle.h

00001 #ifndef SHUTTLE_H_
00002 #define SHUTTLE_H_
00003 
00004 #include "misc.h"
00005 
00006 // COLLISION_CODES returned by update_shuttle. Simplifies processing in main.
00007 enum Collision_Codes
00008 {
00009     NO_COLLISION,           // no collision detected
00010     CONT_VOLLEY,            // collision detected; continue volley
00011     POINT_P1,               // player 1 scores
00012     POINT_P2                // player 2 scores
00013 };
00014 
00015 typedef struct shuttle
00016 {
00017     int x0, y0;                 // initial positions per volley
00018     float vx0, vy0;             // initial velocities per volley
00019     int x, y;                   // current positions of shuttle
00020     float time_elapsed;         // cumulative time in air
00021     bool is_live;               // if shuttle has been served
00022     racket *last_possession;    // last player to touch shuttle
00023 } shuttle;
00024 
00025 // Initialize shuttle struct members. Racket* parameter is player starting with
00026 // shuttle.
00027 void init_shuttle(shuttle*, racket*);
00028 
00029 // Calculate the next position of the shuttle using the kinematic equations. Return
00030 // collision code.
00031 int update_shuttle(GSYNC*, shuttle*);
00032 
00033 #endif