filled rects, they turn now

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

Fork of 4180Lab4SimonSays by Elizabeth Robelo

main.cpp

Committer:
elirobelo
Date:
2017-03-09
Revision:
0:aa7531dac907
Child:
1:cd20b1555770

File content as of revision 0:aa7531dac907:

#include "mbed.h"
#include "SDFileSystem.h"
#include "uLCD_4DGL.h"
#include "wave_player.h"
#include "Joystick.h"


Nav_Switch myNav( p9, p6, p7, p5, p8);
uLCD_4DGL uLCD(p28, p27, p29);
SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card

int arrowVec[20];


int arrow;

void mainMenu() {
    uLCD.baudrate(BAUD_3000000);
    while(1){
        uLCD.locate(3,2);
        uLCD.puts("Simon Says");
        uLCD.locate(3,6);
        uLCD.puts("Start");
        if(myNav.fire()) {
            uLCD.cls();
            return;
        }
}
}
void createArrows(int lev) {

    for (int i = 0; i < lev; i++) {
        if (arrowVec[i] == 1) {
            uLCD.triangle(15, 50, 35, 45, 35, 75, RED);
            uLCD.rectangle(35,50,85,70,RED);
        } else if (arrowVec[i] == 2) {
            //uLCD.triangle(int x1, int y1 , int x2, int y2, int x3, int y3, RED);
            uLCD.rectangle(35,50,85,70,BLUE);     
        } else if (arrowVec[i] == 3) {
            //uLCD.triangle();
            uLCD.rectangle(35,50,85,70,GREEN);
        } else {
            uLCD.rectangle(35,50,85,70,WHITE);
        }
    }
}


int main() {
    bool game = true;
    int level = 0;
    //int arrowVec[20]; 
    //void mainMenu();
    
    
    while(game) {
        level++;
//        for (int i = 0; i < level; i++) { 
//            arrow = (rand() % 4) + 1;
//            arrowVec[i] = arrow;
//        }
        arrowVec[0] = 1;
        createArrows(level);
        game = false;    
    }
    

}