Mbed project for a FRDM-K64F microcontroller. Game made out of five sub-games including flappy birds, snake, stack, trivia and space invaders.

Dependencies:   mbed

Fork of The_Children_of_Cronos_el15mggr by ELEC2645 (2016/17)

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers taurolib.h Source File

taurolib.h

00001 #ifndef TAUROLIB_H
00002 #define TAUROLIB_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 
00008 /** taurolib Class
00009  * @brief Library for the fith game, Tauro
00010 * @brief Revision 1.3
00011 * @author Mateo Randulfe
00012 * @date May 2017
00013  */
00014 
00015 
00016 class taurolib
00017 {
00018 public:
00019     /** Constructor */
00020     taurolib();
00021     /**
00022     function for showing how to start game
00023     * @param lcd neccesary for displaying on the screen
00024     */
00025     void intro(N5110 &lcd);
00026     /*
00027     * checks if the answer selected is correct and depending on that it goes to the
00028     * transition screen directly or passing through the points penalty message
00029     * it also adds points if the answer was right
00030     * @param lcd prints in the screen
00031     * @param a selects the desired answer option
00032     */
00033     void update(N5110 &lcd,DigitalOut &a);
00034     /**
00035     * main draw function that draws the question on the screen and which option is the cursor on(rectangle filled black)
00036     * it also allows to switch between answer options selecting the desired one
00037     * @param pad/b/x switches between options
00038     * @param lcd draws in the screen
00039     */
00040     void draw(N5110 &lcd,Gamepad &pad,DigitalOut &b,DigitalOut &x);
00041     /**
00042     * fills black the option rectangle selected while the rest of them are transparent filled
00043     * @param lcd prints in the screen
00044     */
00045     void drawselect(N5110 &lcd);
00046     /**
00047     * draws the appropiate question for each state
00048     * @param lcd print in the screen
00049     */
00050     void drawquestion(N5110 &lcd);
00051     /** draws the points penalty due to the failed answer
00052     * @param lcd prints in screen
00053     */
00054     void gameover(N5110 &lcd);
00055     /**
00056     * draws the message between levels indicating in which level are you, your score and the subject of the next question
00057     * @param lcd prints in screen
00058     */
00059     void transition(N5110 &lcd);
00060     /**
00061     * assemblies the game
00062     * @param pad/b/x answer selector
00063     * @param start starts game
00064     * @param a selects answer
00065     */
00066     void game(N5110 &lcd,Gamepad &pad,DigitalOut &a,DigitalOut &start,DigitalOut &b,DigitalOut &x);
00067     
00068     /** sets initial state values*/
00069     void init();
00070     
00071     /**
00072     * @returns score
00073     */
00074     int score ();
00075 
00076 
00077     int _state;
00078     int _output;
00079     int _count;
00080     int _score;
00081 //checks if the have started or not
00082     bool _yes;
00083 //for score
00084     char _buffer[20];
00085 #define NOTE_A1  55
00086 };
00087 #endif