Game for Project 2

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed wave_player

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers map_public.h Source File

map_public.h

Go to the documentation of this file.
00001 /* Gatech ECE2035 2015 SPRING PAC MAN
00002  * Copyright (c) 2015 Gatech ECE2035
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to deal
00006  * in the Software without restriction, including without limitation the rights
00007  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008  * copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00020  * SOFTWARE.
00021  */
00022 /** @file map_public.h */
00023 #ifndef MAP_PUBLIC_H
00024 #define MAP_PUBLIC_H
00025 
00026 /// The enum define the status of a grid on the map
00027 typedef enum {
00028     GRID_SIDE_WALK=0,   //Side_walk
00029     GRID_CANDY,         ///< A candy
00030     GRID_BIG_CANDY,     // Bigger candy!
00031     GRID_ROAD_L,        //Road left
00032     GRID_ROAD,
00033     GRID_ROAD_R,
00034     GRID_V_LINE,        //V_line
00035     GRID_SIDE_WALK_2,
00036 } GRID_STATUS;
00037 
00038 /// The structure to store the information of a grid
00039 typedef struct {
00040     int x;               ///< The upper-left corner of the grid. It is the x coordinate on the screen.
00041     int y;               ///< The upper-left corner of the grid. It is the y coordinate on the screen.
00042     GRID_STATUS status;  ///< See enum GRID_STATUS
00043 } GRID;
00044 
00045 /** Call map_init() once at the begining of your code
00046     @brief It initialize the map structure and draw the map.
00047 */
00048 void map_init(void);
00049 
00050 /** Remove the cookie/super-cookie from map
00051     @brief It could be called by Pacman when it eat the cookie.
00052     @param grid_x The horizontal position in the grid.
00053     @param grid_y The vertical position in the grid.
00054     @return 1:There is a cookie be eaten. 0:The is no cookie at the grid.
00055 */
00056 bool map_eat_candy(int grid_x, int grid_y);
00057 
00058 /** Get the information about the grid
00059     @param grid_x The horizontal position in the grid.
00060     @param grid_y The vertical position in the grid.
00061     @return The data structure of the grid. You could access the contents by using the_grid.x , the_grid.status ... etc.
00062 */
00063 GRID map_get_grid_status(int grid_x, int grid_y);
00064 
00065 /** Draw the grid
00066     @param grid_x The horizontal position in the grid.
00067     @param grid_y The vertical position in the grid.
00068 */
00069 void map_draw_grid(unsigned grid_x, unsigned grid_y);
00070 
00071 /** Get the number of remaining cookie.
00072     @brief The game should be ended when there is no cookie.
00073     @return The number of remaining cookie.
00074 */
00075 int  map_remaining_candy(void);
00076 
00077 #endif //MAP_H