f

Dependencies:   mbed 4DGL-uLCD-SE MMA8452

main.cpp

Committer:
lballard9
Date:
2022-03-11
Revision:
4:0c0940591fb1
Parent:
3:ebf55ea6f18b
Child:
5:077b66dfe296

File content as of revision 4:0c0940591fb1:

//=================================================================
// The main program file.
//
// Copyright 2022 Georgia Tech.  All rights reserved.
// The materials provided by the instructor in this course are for
// the use of the students currently enrolled in the course.
// Copyrighted course materials may not be further disseminated.
// This file must not be made publicly available anywhere.
//==================================================================

// External libs
#include <stdlib.h>

// Project includes
#include "globals.h"
#include "hardware.h"
#include "graphics.h"
#include "keyboard.h"


//some LED's to use for debugging.
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
DigitalOut myled4(LED4);

void set_random_seed(Timer);

/*
* This function handles the main logic of the game. You should
* initialize the hardware in this function, make calls to 
* functions that update the keyboard and your guess of 
* the word. 
*/
int main()
{
    
    GameInputs inputs; 
    // First things first: initialize hardware
    ASSERT_P(hardware_init() == ERROR_NONE, "Hardware init failed!");
    pc.printf("Program Starting\n");
    //led1 hardware initialization
    
    myled1=1;  
    Timer t;
    int dt; // delta time
    
/*
Put your code for main menu here, seed random function here as well
*/

// initialize the game state, print something to the screen and wait for an input.
// do that before entering this game loop

while(1){
        t.start(); //start a timer
        draw_lower_status(); //draw the lower status bar
        inputs = read_inputs(); //read the inputs of the game
        
        
        /*
        your code here, make decisions based on those inputs, update the keyboard
        make selections, update words etc.
        */
        
        t.stop();
        dt = t.read_ms();
        if (dt < 100) wait_ms(100 - dt);
        
        }
}



/*
* This function sets the random seed for the game. 
* It also initializes the keyboard. You may choose to
* put the start screen in here as well. This should be
* called in the main function above.
*/
void set_random_seed(Timer t) {
    
    
// set up a GameInputs variable
//run t.start(); to start the timer
// create a while loop that waits for player input to break
//run t.stop(); to end the timer
//int seed = t.read_ms(); to read the number of milliseconds elapsed between the start and stop
//call srand(seed);
//run init_keyboard();



}
// ===User implementations end===