Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE EthernetInterface Game_Synchronizer MMA8452 SDFileSystem Sound mbed-rtos mbed wave_player
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
Generated on Thu Aug 4 2022 10:49:55 by
1.7.2