Ransom Conant / Mbed 2 deprecated MbedPacman

Dependencies:   4DGL-uLCD-SE mbed wave_player

Fork of PacMan_Skeleton_unlock by ECE 2035 TA

pacman.h

Committer:
rconant6
Date:
2018-03-29
Revision:
1:fbda247b843b
Parent:
0:be33a1fad8c0

File content as of revision 1:fbda247b843b:

/* Gatech ECE2035 2015 SPRING PAC MAN
 * Copyright (c) 2015 Gatech ECE2035
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
/** @file pacman.h */
#ifndef PACMAN_H
#define PACMAN_H

#define PACMAN_COLOR 0xFFFFFF

/// The enum defines the status of a pacman
typedef enum {
    PACMAN_WAIT_COMMAND=0,
    PACMAN_RUNNING
} PACMAN_STATUS;

/// The enum defines the motion of a pacman
typedef enum {
    PACMAN_NO_UPDATE=0,
    PACMAN_HEADING_UP,
    PACMAN_HEADING_DOWN,
    PACMAN_HEADING_RIGHT,
    PACMAN_HEADING_LEFT
} PACMAN_MOTION;

/// This struct contains the status of a pacman
typedef struct {
    int grid_x;        ///< The position of pacman on the grid
    int grid_y;        ///< The position of pacman on the grid
    PACMAN_MOTION motion;
    PACMAN_STATUS status;  ///< See enum CITY_STATUS
} PLAYER;

/** Resets the score for pacman

*/
int pacman_get_x(void);
int pacman_get_y(void);
void pacman_add_score(int add);

void pacman_reset_score(void);

/** Initialize a pacman with given position. The default mostion is PACMAN_HEADING_RIGHT
    and status is PACMAN_WAIT_COMMAND. 
    @param blk_x The horizontal position in the grid.
    @param blk_y The vertical position in the grid.
*/
void pacman_init(int grid_x, int grid_y);

/** Draw the pacman on the screen with different mouse direction base on current motion
*/
void pacman_draw(void);

// Clear the pacman in map
void pacman_clear(void);

/** Set the pacman's motion according to the input mostion
    @param motion The desired pacman motion.
*/
void pacman_set_action(PACMAN_MOTION motion);

// Update the pacman's position in map
int pacman_update_position(int level);


#endif