2035
Dependencies: 4DGL-uLCD-SE mbed wave_player
Fork of missile_command by
city_landscape/city_landscape_public.h@3:7e33224a6f1d, 2016-11-09 (annotated)
- Committer:
- tianyeapply
- Date:
- Wed Nov 09 17:04:42 2016 +0000
- Revision:
- 3:7e33224a6f1d
- Parent:
- 1:3da29f1d84b4
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
arvahsu | 0:532cb55d6136 | 1 | /* Gatech ECE2035 2014 FALL missile command |
arvahsu | 0:532cb55d6136 | 2 | * Copyright (c) 2014 Gatech ECE2035 |
arvahsu | 0:532cb55d6136 | 3 | * |
arvahsu | 0:532cb55d6136 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
arvahsu | 0:532cb55d6136 | 5 | * of this software and associated documentation files (the "Software"), to deal |
arvahsu | 0:532cb55d6136 | 6 | * in the Software without restriction, including without limitation the rights |
arvahsu | 0:532cb55d6136 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
arvahsu | 0:532cb55d6136 | 8 | * copies of the Software, and to permit persons to whom the Software is |
arvahsu | 0:532cb55d6136 | 9 | * furnished to do so, subject to the following conditions: |
arvahsu | 0:532cb55d6136 | 10 | * |
arvahsu | 0:532cb55d6136 | 11 | * The above copyright notice and this permission notice shall be included in |
arvahsu | 0:532cb55d6136 | 12 | * all copies or substantial portions of the Software. |
arvahsu | 0:532cb55d6136 | 13 | * |
arvahsu | 0:532cb55d6136 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
arvahsu | 0:532cb55d6136 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
arvahsu | 0:532cb55d6136 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
arvahsu | 0:532cb55d6136 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
arvahsu | 0:532cb55d6136 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
arvahsu | 0:532cb55d6136 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
arvahsu | 0:532cb55d6136 | 20 | * SOFTWARE. |
arvahsu | 0:532cb55d6136 | 21 | */ |
arvahsu | 0:532cb55d6136 | 22 | /** @file city_landscape_public.h */ |
arvahsu | 0:532cb55d6136 | 23 | #ifndef CITY_LANDSCAPE_PUBLIC_H |
arvahsu | 0:532cb55d6136 | 24 | #define CITY_LANDSCAPE_PUBLIC_H |
arvahsu | 0:532cb55d6136 | 25 | |
arvahsu | 0:532cb55d6136 | 26 | /// The enum define the status of a city |
arvahsu | 0:532cb55d6136 | 27 | typedef enum { |
arvahsu | 0:532cb55d6136 | 28 | EXIST=1, ///< The city will be shown on screen |
arvahsu | 1:3da29f1d84b4 | 29 | DESTROYED=0 ///< The city won't be shown on screen |
arvahsu | 0:532cb55d6136 | 30 | } CITY_STATUS; |
arvahsu | 0:532cb55d6136 | 31 | |
arvahsu | 0:532cb55d6136 | 32 | /// The structure to store the information of a city |
arvahsu | 0:532cb55d6136 | 33 | typedef struct { |
arvahsu | 0:532cb55d6136 | 34 | int x; ///< Bottom-left corner of the city. x coordinate on the screen. |
arvahsu | 0:532cb55d6136 | 35 | int y; ///< Bottom-left corner of the city. y coordinate on the screen. |
arvahsu | 0:532cb55d6136 | 36 | int width; ///< The width of the city. The shape of the city is an rectangle. |
arvahsu | 0:532cb55d6136 | 37 | int height; ///< The height of the city |
arvahsu | 0:532cb55d6136 | 38 | CITY_STATUS status; ///< See enum CITY_STATUS |
arvahsu | 0:532cb55d6136 | 39 | } CITY; |
arvahsu | 0:532cb55d6136 | 40 | |
arvahsu | 0:532cb55d6136 | 41 | #define MAX_NUM_CITY 6 |
arvahsu | 0:532cb55d6136 | 42 | |
arvahsu | 0:532cb55d6136 | 43 | /** Call city_landscape_init() once at the begining of your code |
arvahsu | 0:532cb55d6136 | 44 | @brief It initialize the city data structure and draw the cities. |
arvahsu | 0:532cb55d6136 | 45 | @param num_city number of city to be draw. It must be less/equal to MAX_NUM_CITY. |
arvahsu | 0:532cb55d6136 | 46 | */ |
arvahsu | 0:532cb55d6136 | 47 | void city_landscape_init(int num_city); |
arvahsu | 0:532cb55d6136 | 48 | |
arvahsu | 0:532cb55d6136 | 49 | /** Get the information of city |
arvahsu | 0:532cb55d6136 | 50 | @param index The index in city_record. It must be smaller than MAX_NUM_CITY. |
arvahsu | 0:532cb55d6136 | 51 | @return The structure of city information |
arvahsu | 0:532cb55d6136 | 52 | */ |
arvahsu | 0:532cb55d6136 | 53 | CITY city_get_info(int index); |
arvahsu | 0:532cb55d6136 | 54 | |
arvahsu | 0:532cb55d6136 | 55 | /** Remove the city from its record and the screen |
arvahsu | 0:532cb55d6136 | 56 | @param index The index in city_record. It must be smaller than MAX_NUM_CITY. |
arvahsu | 0:532cb55d6136 | 57 | */ |
arvahsu | 1:3da29f1d84b4 | 58 | void city_destroy(int index); |
arvahsu | 0:532cb55d6136 | 59 | |
arvahsu | 0:532cb55d6136 | 60 | /** Draw all exist cities on the screen |
arvahsu | 0:532cb55d6136 | 61 | @brief You might not need to use this function, but you could still use it if you want. |
arvahsu | 0:532cb55d6136 | 62 | */ |
arvahsu | 0:532cb55d6136 | 63 | void draw_cities(void); |
arvahsu | 0:532cb55d6136 | 64 | |
arvahsu | 0:532cb55d6136 | 65 | /** Draw the landscape |
arvahsu | 0:532cb55d6136 | 66 | @brief You might not need to use this function, but you could still use it if you want. |
arvahsu | 0:532cb55d6136 | 67 | */ |
arvahsu | 0:532cb55d6136 | 68 | void draw_landscape(void); |
arvahsu | 0:532cb55d6136 | 69 | |
arvahsu | 0:532cb55d6136 | 70 | |
arvahsu | 0:532cb55d6136 | 71 | #endif //CITY_LANDSCAPE_H |