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 pacman.h Source File

pacman.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 pacman.h */
00023 #ifndef PACMAN_H
00024 #define PACMAN_H
00025 
00026 #define PACMAN_COLOR 0xFFFFFF
00027 
00028 /// The enum defines the status of a pacman
00029 typedef enum {
00030     PACMAN_WAIT_COMMAND=0,
00031     PACMAN_RUNNING
00032 } PACMAN_STATUS;
00033 
00034 /// The enum defines the motion of a pacman
00035 typedef enum {
00036     PACMAN_NO_UPDATE=0,
00037     PACMAN_HEADING_UP,
00038     PACMAN_HEADING_DOWN,
00039     PACMAN_HEADING_RIGHT,
00040     PACMAN_HEADING_LEFT
00041 } PACMAN_MOTION;
00042 
00043 /// This struct contains the status of a pacman
00044 typedef struct {
00045     int grid_x;        ///< The position of pacman on the grid
00046     int grid_y;        ///< The position of pacman on the grid
00047     PACMAN_MOTION motion;
00048     PACMAN_STATUS status;  ///< See enum CITY_STATUS
00049 } PLAYER;
00050 
00051 /** Resets the score for pacman
00052 
00053 */
00054 int pacman_get_x(void);
00055 int pacman_get_y(void);
00056 void pacman_add_score(int add);
00057 
00058 void pacman_reset_score(void);
00059 
00060 /** Initialize a pacman with given position. The default mostion is PACMAN_HEADING_RIGHT
00061     and status is PACMAN_WAIT_COMMAND. 
00062     @param blk_x The horizontal position in the grid.
00063     @param blk_y The vertical position in the grid.
00064 */
00065 void pacman_init(int grid_x, int grid_y);
00066 
00067 /** Draw the pacman on the screen with different mouse direction base on current motion
00068 */
00069 void pacman_draw(void);
00070 
00071 // Clear the pacman in map
00072 void pacman_clear(void);
00073 
00074 /** Set the pacman's motion according to the input mostion
00075     @param motion The desired pacman motion.
00076 */
00077 void pacman_set_action(PACMAN_MOTION motion);
00078 
00079 // Update the pacman's position in map
00080 int pacman_update_position(int level);
00081 
00082 
00083 #endif