Weiyu Liu / Mbed 2 deprecated DanceDanceRevolutionMbed1

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers releaser.h Source File

releaser.h

00001 #ifndef RELEASER_H
00002 #define RELEASER_H
00003 
00004 
00005 #include "mbed.h"
00006 #include "arrows.h"
00007 
00008 //releaser.h: responsible for keeping track of arrows that are active on the screen
00009 
00010 class ArrowReleaser {
00011     private:
00012         int terminate;
00013     public:
00014         Arrow ActiveArrows [10];  
00015         ArrowReleaser(){
00016             for(int i=0; i< 10; i++){
00017                 ActiveArrows[i] = Arrow(-1);   
00018             } 
00019             terminate = 0;    
00020         }
00021         int ReleaseArrow(Arrow songArrows[], int indexSongArray, int screens){
00022             for(int i=0; i< 10; i++){
00023                 if(!ActiveArrows[i].getActive()){
00024                     //Empty space
00025                     ActiveArrows[i] = songArrows[indexSongArray];
00026                     if(ActiveArrows[i].getType() == -1){
00027                         ActiveArrows[i].setActive(0);    
00028                     }
00029                     else {
00030                         ActiveArrows[i].setActive(1);
00031                     }    
00032                     ActiveArrows[i].init(screens);
00033                     return 1;
00034                 }   
00035             }
00036             return 0;
00037         }      
00038         int ReleaseArrow2(Arrow songArrows[], int indexSongArray){
00039             for(int i=0; i< 7; i++){
00040                 if(!ActiveArrows[i].getActive()){
00041                     //Empty space
00042                     ActiveArrows[i] = songArrows[indexSongArray];
00043                     if(ActiveArrows[i].getType() == -1){
00044                         ActiveArrows[i].setActive(0);    
00045                     }
00046                     else {
00047                         ActiveArrows[i].setActive(1);
00048                     }    
00049                     ActiveArrows[i].init2();
00050                     return 1;
00051                 }   
00052             }
00053             return 0;
00054         }          
00055         int getTermStatus(){
00056             return terminate;
00057         }
00058         void setTermStatus(int status){
00059             terminate = status;
00060         }
00061     
00062 };
00063 
00064 #endif