Ransom Conant / Mbed 2 deprecated MbedPacman

Dependencies:   4DGL-uLCD-SE mbed wave_player

Fork of PacMan_Skeleton_unlock by ECE 2035 TA

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_EMPTY=0,
00029     GRID_WALL,           ///< It is wall
00030     GRID_COOKIE,         ///< A cookie is at here
00031     GRID_SUPER_COOKIE    ///< A super cookie is at here
00032 } GRID_STATUS;
00033 
00034 /// The structure to store the information of a grid
00035 typedef struct {
00036     int x;               ///< The upper-left corner of the grid. It is the x coordinate on the screen.
00037     int y;               ///< The upper-left corner of the grid. It is the y coordinate on the screen.
00038     GRID_STATUS status;  ///< See enum GRID_STATUS
00039 } GRID;
00040 
00041 /** Call map_init() once at the begining of your code
00042     @brief It initialize the map structure and draw the map.
00043 */
00044 void map_init(void);
00045 
00046 /** Remove the cookie/super-cookie from map
00047     @brief It could be called by Pacman when it eat the cookie.
00048     @param grid_x The horizontal position in the grid.
00049     @param grid_y The vertical position in the grid.
00050     @return 1:There is a cookie be eaten. 0:The is no cookie at the grid.
00051 */
00052 bool map_eat_cookie(int grid_x, int grid_y);
00053 
00054 /** Get the information about the grid
00055     @param grid_x The horizontal position in the grid.
00056     @param grid_y The vertical position in the grid.
00057     @return The data structure of the grid. You could access the contents by using the_grid.x , the_grid.status ... etc.
00058 */
00059 GRID map_get_grid_status(int grid_x, int grid_y);
00060 
00061 /** Draw the grid
00062     @param grid_x The horizontal position in the grid.
00063     @param grid_y The vertical position in the grid.
00064 */
00065 void map_draw_grid(unsigned grid_x, unsigned grid_y);
00066 
00067 /** Get the number of remaining cookie.
00068     @brief The game should be ended when there is no cookie.
00069     @return The number of remaining cookie.
00070 */
00071 int  map_remaining_cookie(void);
00072 
00073 #endif //MAP_H