Kern Fowler / Mbed 2 deprecated Donkey_Kong_Game

Dependencies:   mbed

main.h

Committer:
Kern_EL17KJTF
Date:
2019-05-07
Revision:
9:e6832bf222b7
Parent:
8:421f94b816c4
Child:
10:28575a6eaa13

File content as of revision 9:e6832bf222b7:

#ifndef MAIN_H
#define MAIN_H

// include the different header files
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"

// main menu ------------------------
void init();
void print_menu();
void welcome();
void arrow_location();
void arrow_select();
int menu_arrow[7][7] = { // Arrow pointer used in main menu
{0,0,0,0,0,0,0,},
{0,0,0,0,1,0,0,},
{0,0,0,0,1,1,0,},
{1,1,1,1,1,1,1,},
{0,0,0,0,1,1,0,},
{0,0,0,0,1,0,0,},
{0,0,0,0,0,0,0,},
};

int menu_dk_face[36][34] =   { // donkey kong face for menu
    { 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,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,0,0,0,0,0,0,0,1,1,1,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,1,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,1,0,0,0,1,1,1,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,0,1,0,0,0,1,1,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,1,1,0,0,0,0,0,1,1,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,1,0,0,1,1,1,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,0,1,1,1,1,0,1,1,0,0,0,0 },
    { 0,0,0,0,0,0,1,1,0,0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key();

    ~Donkey();

    void donkeykong_movement(Gamepad &pad, N5110 &lcd);

};

int game_dk_walking_right_1[16][16] = {
    {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,1,},
    {1,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,0,1,},
    {1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,},
    {1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,},
    {1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,},
    {1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,},
    {1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,},
    {1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,},
    {1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,},
    {1,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,0,1,},
    {1,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,0,1,},
    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
};

int game_dk_walking_left_1[16][16] = {
    {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,1,},
    {1,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,0,1,},
    {1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,},
    {1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,},
    {1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,},
    {1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,},
    {1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,},
    {1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,},
    {1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,},
    {1,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,0,1,},
    {1,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,0,1,},
    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},
};

int game_dk_stationary[16][16] = {
    {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,1,},
    {1,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,0,1,},
    {1,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,0,1,},
    {1,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,0,1,},
    {1,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,0,1,},
    {1,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,0,1,},
    {1,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,0,1,},
    {1,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,},
};
// Barrel -----

class Barrel
{

    public:

    Barrel();

    ~Barrel();

    void barrel_drop(Gamepad &pad, N5110 &lcd);
};

int game_barrel[4][8] = {
    {0,1,1,1,1,1,1,0,},
    {1,1,1,1,1,1,1,1,},
    {1,1,1,1,1,1,1,1,},
    {0,1,1,1,1,1,1,0,},
};
// Banana -----

// Game Engine ----------------------
Barrel barrel;

class GameEngine
{

    public: 

    GameEngine();

    ~GameEngine();

    void gameengine_run(Gamepad &pad, N5110 &lcd, Barrel &barrel);
};
// Controls -------------------------
void controls_run();
// Instructions ---------------------
void instructions_run();
// Options --------------------------

class Options
{

    public:

    Options();

    ~Options();

    void options_run(Gamepad &pad, N5110 &lcd);
    void options_brightness(Gamepad &pad, N5110 &lcd);
    void options_contrast(Gamepad &pad, N5110 &lcd);
    void options_volume(Gamepad &pad, N5110 &lcd);


};

// High Scores-----------------------
void high_scores_run();

#endif