Game for Leeds University Gamepad for the FRDM-K64F: Game is a RPG Horror Title.

Dependencies:   mbed FATFileSystem

main.cpp

Committer:
rottenegg
Date:
2019-04-23
Revision:
8:e3a76a808a4c
Parent:
7:cbec3402b4e3
Child:
9:ac396c818874

File content as of revision 8:e3a76a808a4c:

/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
Name:Saad Tayyab
Username:el17st
Student ID Number:201145512
Date: 18/04/2019
*/

#include "mbed.h"
#include "WDplayer.h"
#include "SDFileSystem.h"
#include "Bitmap.h"
#include "CaMove.h"
#include "SceneCreator.h"

SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd");
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
CaMove CM(PTB9,PTB11,PTB10);
SceneCreator SNC;

int main() {
    lcd.init();
    SNC.Scenesp(lcd,CM,0,40,20,Fd);
    
}

/*

SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd");
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
CaMove CM(PTB9,PTB11,PTB10);

void speak();
void speak2();
void trans();

int main() {
    int evecount = 0;
    CM.init(40,20,Fd);
    lcd.init();
    CM.set_region(4,21,5,24);
    CM.set_region(71,31,10,14); // region 0
    
    while(CM.in_screen()) {
        lcd.clear();
        Bitmap::renderBMP(SCN[0],lcd,0,0);
        
        if (evecount == 0) {
            lcd.drawRect(5,2,18,2,FILL_BLACK);
            lcd.drawRect(4,21,5,24,FILL_BLACK);
        }
        
        CM.move(lcd);
        int x = CM.get_treg();
        //Interative Region 1 Triggered
        if (x == 0) {
            evecount = 1;
            trans();
            speak();
            trans();
        }
        if (x == 1) {
            trans();
            speak2();
            trans();
        
        }
        lcd.refresh();
        wait(0.1);
    }
}
void trans() {
    for (int i = 0;i < 84;i++) {
    lcd.drawRect(0,0,i,48,FILL_BLACK);
    lcd.refresh();
    }
    for (int i = 0;i < 84;i++) {
    lcd.drawRect(0,0,i,48,FILL_WHITE);
    lcd.refresh();
    }
}

void speak() {
    lcd.clear();
    lcd.printString("Hello my name",0,0);
    lcd.printString("Veigar i shall",0,1);
    lcd.printString("Help you ...",0,2);
    lcd.printString("find what you",0,3);
    lcd.printString("seek. now go..",0,4);
    lcd.refresh();
    wait(1);
}

void speak2() {
    lcd.clear();
    lcd.printString("its a lamp",0,0);
    lcd.printString("quite eerie",0,1);
    lcd.refresh();
    wait(1);
}

*/