Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

StartScreen/StartScreen.cpp

Committer:
AhmedPlaymaker
Date:
2019-03-26
Revision:
7:48ba87cd79b5
Parent:
6:3ffab44ed49c
Child:
9:d1d79d4ee673

File content as of revision 7:48ba87cd79b5:

#include "StartScreen.h"
Settings settings;

int sprite[48][84] = {
    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
    {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
    {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
    {1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
    {1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,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0,0,0,0,0,0,0,0,1},
    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},

};
    
int arrow[7][9] = {
    {0,0,0,0,1,0,0,0,0},
    {0,0,0,1,1,0,0,0,0},
    {0,0,1,1,1,0,0,0,0},
    {0,1,1,1,1,1,1,1,1},
    {0,0,1,1,1,0,0,0,0},
    {0,0,0,1,1,0,0,0,0},
    {0,0,0,0,1,0,0,0,0},
};
    
int bullet[13][5] = {
    {1,0,0,0,1},
    {1,0,0,0,1},
    {0,1,0,1,0},
    {0,0,1,0,0},
    {0,0,0,0,0},
    {0,0,1,0,0},
    {0,0,1,0,0},
    {0,0,0,0,0},
    {0,0,0,0,0},
    {0,0,0,0,0},
    {0,0,0,0,0},
    {0,0,1,0,0},
    {0,0,1,0,0},
};
int navL[13][8] = {
    {0,0,0,0,0,0,1,1},
    {0,0,0,0,0,1,1,0},
    {0,0,0,0,1,1,0,0},
    {0,0,0,1,1,0,0,0},
    {0,0,1,1,0,0,0,0},
    {0,1,1,0,0,0,0,0},
    {1,1,0,0,0,0,0,0},
    {0,1,1,0,0,0,0,0},
    {0,0,1,1,0,0,0,0},
    {0,0,0,1,1,0,0,0},
    {0,0,0,0,1,1,0,0},
    {0,0,0,0,0,1,1,0},
    {0,0,0,0,0,0,1,1},
};

int navR[13][8] = {
    {1,1,0,0,0,0,0,0},
    {0,1,1,0,0,0,0,0},
    {0,0,1,1,0,0,0,0},
    {0,0,0,1,1,0,0,0},
    {0,0,0,0,1,1,0,0},
    {0,0,0,0,0,1,1,0},
    {0,0,0,0,0,0,1,1},
    {0,0,0,0,0,1,1,0},
    {0,0,0,0,1,1,0,0},
    {0,0,0,1,1,0,0,0},
    {0,0,1,1,0,0,0,0},
    {0,1,1,0,0,0,0,0},
    {1,1,0,0,0,0,0,0},
};
int i=16;
int lr=1;
int gs=1; 
int st=1;
int sc=1;  
float cs = 4;
StartScreen::StartScreen()
{
    
}

StartScreen::~StartScreen()
{

}



void StartScreen::screen_saver(N5110 &lcd, Gamepad &pad)
{
    int ani = -48;
    pad.leds_on();
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(440,0.1);
    wait(0.1);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(494,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(440,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(370,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(392,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(370,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(330,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(247,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(330,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(330,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(370,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(555,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(555,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(494,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(440,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(392,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(392,0.1);
    wait(0.2);
    lcd.clear();
    lcd.drawSprite(0,0,48,84,(int *)sprite); //Function used to draw the sprite
    ani+=3;
    lcd.refresh();
    pad.tone(370,0.1);
    wait(0.6);
    pad.leds_off();
    lcd.clear();
}

void StartScreen::instruct(N5110 &lcd, Gamepad &pad)
{
    lcd.printString("Please Press",5,1); //Function used to promt the user to start.
    lcd.printString("Start",25,3);
    lcd.printString("to Begin",15,5);
    lcd.refresh();
    while ( pad.check_event(Gamepad::START_PRESSED) == false) {
        pad.leds_on();
        wait(0.1);
        pad.leds_off();
        wait(0.1);
    }
    pad.tone(1000.0,0.1);
    lcd.clear();
    pad.leds_off();
}
    
void StartScreen::info(N5110 &lcd, Gamepad &pad)
{   
    if(sc ==1)  {
        lcd.printString("Created BY",8,1);
        lcd.printString("Ahmed",24,3);
        lcd.printString("Adamjee",20,4);
        lcd.printString("201161436",15,5);
        lcd.refresh();
        wait(2);
    }
    lcd.clear();
}

void StartScreen::menu_screen1(N5110 &lcd, Gamepad &pad)
{
    lcd.clear();
    lcd.drawSprite(50,i,7,9,(int *)arrow);
    while ((pad.check_event(Gamepad::JOY_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) {  //Change this to if button pressed.
        lcd.printString("SnakeVSBlock",5,0);
        lcd.printString("Play",0,2);
        lcd.printString("Settings",0,3);
        lcd.printString("Stats",0,4);
        lcd.printString("Tutorial",0,5);
        Direction d = pad.get_direction();
        if((d==N)&&(i>16))  {
                i=i-8;
        }
        if((d==S)&&(i<40))  {
                i=i+8;
        }
        lcd.drawSprite(50,i,7,9,(int *)arrow); //Function used to draw the sprite.
        lcd.refresh();
        wait(1/cs);
        lcd.clear();
    }
    pad.tone(1000.0,0.1);
    
    if(i == 16)
    {
        menu_screen2(lcd, pad);
    }
    else if(i == 24)
    {
        lcd.clear();
        settings.info(lcd, pad);
    
    while (pad.check_event(Gamepad::BACK_PRESSED) == false) {  //if button pressed.
        
        Direction d = pad.get_direction();
        wait(1/cs);
    
        if((d==E)&&(st==5))  {
            st=1;
        }
        
        else if((d==W)&&(st==1))  {
            st=5;
        }
        
        else if((d==E)&&(1<=st<=4))  {
            st=st+1;
        }
        
        else if((d==W)&&(2<=st<=5))  {
            st=st-1;
        }
        
        if(st==1)  { 
            lcd.clear();
            lcd.drawSprite(5,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(71,22,13,8,(int *)navR); //Function used to draw the sprite.
            cs = settings.controlSensitivity(lcd, pad);
            lcd.refresh();
        }
        if(st==2)  {
            lcd.clear();
            lcd.drawSprite(5,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(71,22,13,8,(int *)navR); //Function used to draw the sprite.
            settings.brigntness(lcd, pad);
            lcd.refresh();
        }
        if(st==3)  {
            lcd.clear();
            lcd.drawSprite(5,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(71,22,13,8,(int *)navR); //Function used to draw the sprite.
            settings.contrast(lcd, pad);
            lcd.refresh();
        }
        if(st==4)  {
            lcd.clear();
            lcd.drawSprite(5,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(71,22,13,8,(int *)navR); //Function used to draw the sprite.
            settings.volume(lcd, pad);
            lcd.refresh();
        }
        if(st==5)  {
            lcd.clear();
            lcd.drawSprite(5,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(71,22,13,8,(int *)navR); //Function used to draw the sprite.
            sc = settings.showCredits(lcd, pad);
            lcd.refresh();
        }
    }
    menu_screen1(lcd, pad);
    pad.tone(1000.0,0.1);
}
    else
    {
        menu_screen1(lcd, pad);
        lr=1;
    }
    
}
void StartScreen::menu_screen2(N5110 &lcd, Gamepad &pad)
{
    lcd.clear();
    wait(1/cs);
    
    while ((pad.check_event(Gamepad::JOY_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) {  //Change this to if button pressed.
        
        Direction d = pad.get_direction();
        wait(1/cs);
    
        if(((d==E)||(d==W))&&(lr==1))  {
            lr=2;
        }
        
        else if(((d==E)||(d==W))&&(lr==2))  {
            lr=1;
        }
        
        if(lr==1)  {
            lcd.clear();
            lcd.drawRect(27,18,30,20,FILL_TRANSPARENT);
            lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
            lcd.printString("Free Wave",14,1);
            lcd.refresh();
        }
        if(lr==2)  {
            lcd.clear();
            lcd.drawRect(27,18,30,20,FILL_TRANSPARENT);
            lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
            lcd.printString("Bullet Shower",4,1);
            lcd.drawSprite(29,19,13,5,(int *)bullet); //Function used to draw the sprite.
            lcd.refresh();
        }
        if (pad.check_event(Gamepad::BACK_PRESSED) == true) { 
            lcd.clear();
            menu_screen1(lcd, pad);
        }   
    }
    pad.tone(1000.0,0.1);
    
    lcd.clear();
    wait(1/cs);
    menu_screen3(lcd, pad);
}
void StartScreen::menu_screen3(N5110 &lcd, Gamepad &pad)
{
    lcd.clear();
    wait(1/cs);
    
    while ((pad.check_event(Gamepad::JOY_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) {  //Change this to if button pressed.
        
        Direction d = pad.get_direction();
        wait(1/cs);
    
        if((d==E)&&(gs==4))  {
            gs=1;
        }
        
        else if((d==W)&&(gs==1))  {
            gs=4;
        }
        
        else if((d==E)&&(1<=gs<=3))  {
            gs=gs+1;
        }
        
        else if((d==W)&&(2<=gs<=4))  {
            gs=gs-1;
        }
        
        if(gs==1)  {
            lcd.clear();
            lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
            lcd.printString("Game Speed",10,1);
            lcd.printString("SNAIL",26,3);
            lcd.refresh();
        }
        if(gs==2)  {
            lcd.clear();
            lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
            lcd.printString("Game Speed",10,1);
            lcd.printString("TURTLE",24,3);
            lcd.refresh();
        }
        if(gs==3)  {
            lcd.clear();
            lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
            lcd.printString("Game Speed",10,1);
            lcd.printString("RABBIT",24,3);
            lcd.refresh();
        }
        if(gs==4)  {
            lcd.clear();
            lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
            lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
            lcd.printString("Game Speed",10,1);
            lcd.printString("CHEETHA",21,3);
            lcd.refresh();
        }
        
        if (pad.check_event(Gamepad::BACK_PRESSED) == true) {
            lcd.clear();
            wait(1/cs);
            menu_screen2(lcd, pad);
        }
    }
    
    pad.tone(1000.0,0.1);
    lcd.clear();
    wait(1/cs);
}