tao lao
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
Revision 3:33bf11645fe1, committed 2020-11-24
- Comitter:
- hnguyen403
- Date:
- Tue Nov 24 05:05:10 2020 +0000
- Parent:
- 2:4947d6a82971
- Commit message:
- tao lao;
Changed in this revision
--- a/graphics.cpp Fri Oct 23 16:30:18 2020 -0400 +++ b/graphics.cpp Tue Nov 24 05:05:10 2020 +0000 @@ -7,7 +7,38 @@ #include "graphics.h" #include "globals.h" +#define YELLOW 0xFFFF00 +#define BROWN 0xD2691E +#define DIRT BROWN +const char head[121] = { + 'G','G','G','G','G','G','G','G','G','G','G', + 'G','R','R','R','G','G','G','R','R','R','G', + 'G','R','R','R','G','G','G','R','R','R','G', + 'G','R','R','R','G','G','G','R','R','R','G', + 'G','G','G','G','G','G','G','G','G','G','G', + 'G','G','G','G','G','G','G','G','G','G','G', + 'G','G','G','G','G','G','G','G','G','G','G', + 'G','R','R','R','G','G','G','R','R','R','G', + 'G','R','R','R','G','G','G','R','R','R','G', + 'G','R','R','R','G','G','G','R','R','R','G', + 'G','G','G','G','G','G','G','G','G','G','G', + }; + +const char tail[121] = { + 'G','G','G','G','G','G','G','G','G','G','G', + 'G','Y','Y','Y','G','G','G','Y','Y','Y','G', + 'G','Y','Y','Y','G','G','G','Y','Y','Y','G', + 'G','Y','Y','Y','G','G','G','Y','Y','Y','G', + 'G','G','G','G','G','G','G','G','G','G','G', + 'G','G','G','G','G','G','G','G','G','G','G', + 'G','G','G','G','G','G','G','G','G','G','G', + 'G','Y','Y','Y','G','G','G','Y','Y','Y','G', + 'G','Y','Y','Y','G','G','G','Y','Y','Y','G', + 'G','Y','Y','Y','G','G','G','Y','Y','Y','G', + 'G','G','G','G','G','G','G','G','G','G','G', + }; + void draw_nothing(int u, int v) { uLCD.filled_rectangle(u, v, u+10, v+10, BLACK); @@ -32,7 +63,7 @@ void draw_wall(int u, int v) { - uLCD.filled_rectangle(u, v, u+10, v+10, BLACK); + uLCD.filled_rectangle(u, v, u+10, v+10, DGREY); } void draw_plant(int u, int v) @@ -42,9 +73,10 @@ void draw_goodie(int u, int v) { - uLCD.filled_rectangle(u, v, u+10, v+10, GREEN); + uLCD.filled_rectangle(u, v, u+10, v+10, 0xD2691E); //DIRT } + void draw_snake_body(int u, int v) { uLCD.filled_rectangle(u, v, u+10, v+10, GREEN); @@ -54,15 +86,19 @@ { //May need to design a snake head sprite //Tile still need to be designed on paper - - uLCD.filled_rectangle(u, v, u+10, v+10, GREEN); + draw_img(u,v, head); + //uLCD.filled_rectangle(u, v, u+10, v+10, RED); } void draw_snake_tail(int u, int v) { //May need to design a snake tail sprite //Tile still need to be designed on paper - uLCD.filled_rectangle(u, v, u+10, v+10, GREEN); + uLCD.filled_rectangle(u, v, u+10, v+10, 0xFFFF00); } - - +void draw_snake(int u, int v) +{ + draw_img(u,v, head); + uLCD.filled_rectangle(u, v, u+10, v+10, GREEN); + uLCD.filled_rectangle(u, v, u+21, v+21, 0xFFFF00); +}
--- a/graphics.h Fri Oct 23 16:30:18 2020 -0400 +++ b/graphics.h Tue Nov 24 05:05:10 2020 +0000 @@ -34,6 +34,6 @@ void draw_snake_body(int u, int v); void draw_snake_head(int u, int v); void draw_snake_tail(int u, int v); - +void draw_snake(int u, int v); #endif // GRAPHICS_H \ No newline at end of file
--- a/hardware.cpp Fri Oct 23 16:30:18 2020 -0400 +++ b/hardware.cpp Tue Nov 24 05:05:10 2020 +0000 @@ -29,6 +29,7 @@ // Some hardware also needs to have functions called before it will set up // properly. Do that here. + int hardware_init() { // Crank up the speed @@ -49,5 +50,19 @@ GameInputs read_inputs() { GameInputs in; + + // Read the values and store them in in + //tilting board left = -x + //tilting board down towards table = +y + + in.b1 = button3; //top button on breadboard is connected to p23 + in.b2 = button2; //middle button on breadboard is connected to p22 + in.b3 = button1; //bottom button ob breadboard is connected to p21 + + acc.readXGravity(&in.ax); + acc.readYGravity(&in.ay); + acc.readZGravity(&in.az); + + //pc.printf("xAccel: %f yAccel: %f zAccel: %f\n",in.ax,in.ay,in.az); return in; }
--- a/hardware.h Fri Oct 23 16:30:18 2020 -0400 +++ b/hardware.h Tue Nov 24 05:05:10 2020 +0000 @@ -3,10 +3,10 @@ // the use of the students currently enrolled in the course. // Copyrighted course materials may not be further disseminated. // This file must not be made publicly available anywhere. - + #ifndef HARDWARE_H #define HARDWARE_H - + /** * Structure that represents all the inputs to the game. * If additional hardware is added, new elements should be added to this struct. @@ -15,12 +15,12 @@ int b1, b2, b3; // Button presses double ax, ay, az; // Accelerometer readings }; - + /** * Initialize all the hardware. */ int hardware_init(); - + /** * Read all the user inputs. * This is all input hardware interaction should happen. @@ -28,5 +28,5 @@ * This GameInputs is used elsewhere to compute the game update. */ GameInputs read_inputs(); - + #endif // HARDWARE_H \ No newline at end of file
--- a/hash_table.cpp Fri Oct 23 16:30:18 2020 -0400 +++ b/hash_table.cpp Tue Nov 24 05:05:10 2020 +0000 @@ -1,30 +1,27 @@ +//================================================================= // Copyright 2020 Georgia Tech. All rights reserved. // The materials provided by the instructor in this course are for // the use of the students currently enrolled in the course. // Copyrighted course materials may not be further disseminated. // This file must not be made publicly available anywhere. +//================================================================= /* - Student Name: - Date: - +Student Name: Hung Nguyen +Date: 11/2/2020 ======================= ECE 2035 Project 2-1: ======================= This file provides definition for the structs and functions declared in the header file. It also contains helper functions that are not accessible from outside of the file. - FOR FULL CREDIT, BE SURE TO TRY MULTIPLE TEST CASES and DOCUMENT YOUR CODE. - =================================== Naming conventions in this file: =================================== 1. All struct names use camel case where the first letter is capitalized. e.g. "HashTable", or "HashTableEntry" - 2. Variable names with a preceding underscore "_" will not be called directly. e.g. "_HashTable", "_HashTableEntry" - Recall that in C, we have to type "struct" together with the name of the struct in order to initialize a new variable. To avoid this, in hash_table.h we use typedef to provide new "nicknames" for "struct _HashTable" and @@ -33,23 +30,19 @@ - "HashTable myNewTable;" or - "HashTableEntry myNewHashTableEntry;" - The preceding underscore "_" simply provides a distinction between the names of the actual struct defition and the "nicknames" that we use to initialize new structs. [See Hidden Definitions section for more information.] - 3. Functions, their local variables and arguments are named with camel case, where the first letter is lower-case. e.g. "createHashTable" is a function. One of its arguments is "numBuckets". It also has a local variable called "newTable". - 4. The name of a struct member is divided by using underscores "_". This serves as a distinction between function local variables and struct members. e.g. "num_buckets" is a member of "HashTable". - */ - + /**************************************************************************** * Include the Public Interface * @@ -59,8 +52,8 @@ * correctness, but it is better than nothing! ***************************************************************************/ #include "hash_table.h" - - + + /**************************************************************************** * Include other private dependencies * @@ -69,8 +62,8 @@ ***************************************************************************/ #include <stdlib.h> // For malloc and free #include <stdio.h> // For printf - - + + /**************************************************************************** * Hidden Definitions * @@ -86,14 +79,14 @@ /** The array of pointers to the head of a singly linked list, whose nodes are HashTableEntry objects */ HashTableEntry** buckets; - + /** The hash function pointer */ HashFunction hash; - + /** The number of buckets in the hash table */ unsigned int num_buckets; }; - + /** * This structure represents a hash table entry. * Use "HashTableEntry" instead when you are creating a new variable. [See top comments] @@ -101,18 +94,18 @@ struct _HashTableEntry { /** The key for the hash table entry */ unsigned int key; - + /** The value associated with this hash table entry */ void* value; - + /** * A pointer pointing to the next hash table entry * NULL means there is no next entry (i.e. this is the tail) */ HashTableEntry* next; }; - - + + /**************************************************************************** * Private Functions * @@ -131,9 +124,13 @@ * @return The pointer to the hash table entry */ static HashTableEntry* createHashTableEntry(unsigned int key, void* value) { - + HashTableEntry* newEntry = (HashTableEntry*)malloc(sizeof(HashTableEntry)); + newEntry -> key = key; + newEntry -> value = value; + newEntry -> next = NULL; + return newEntry; } - + /** * findItem * @@ -145,9 +142,74 @@ * @return The pointer to the hash table entry, or NULL if key does not exist */ static HashTableEntry* findItem(HashTable* hashTable, unsigned int key) { - + + // Go through each bucket + int j = 0; + HashTableEntry* k; + while (j < (hashTable -> num_buckets)){ + + // Go to the next bucket if this bucket is empty + if ((hashTable -> buckets)[j] == NULL){ + j++; + continue; + } + + // Check if the first entry of the bucket matches the key + k = (hashTable -> buckets)[j]; // k is the address of the first item of the bucket + if (key == (k -> key)){ + return k; + } + + // Check if other entries in the linked list matches the key + while ((k -> next) != NULL){ + if (key == (k -> next -> key)){ + return (k -> next); + } + + k = (k -> next); + } + j++; + } + return NULL; } - + +// freeBucket() recursively free every entry in a bucket +static void freeBucket(HashTableEntry* item){ + + // Do nothing and return if the memory is null + if (item == NULL){ + return; + } + + // Free the next entry in the linked list if it exists + if(item -> next != NULL){ + freeBucket(item -> next); + } + + // Free this item and return + free(item); + return; +} + +// freeBucket() recursively free every entry in a bucket +static void printBucket(HashTableEntry* item){ + + // Do nothing and return if the memory is null + if (item == NULL){ + printf("Null"); + return; + } + + // Free the next entry in the linked list if it exists + if(item -> next != NULL){ + printBucket(item -> next); + } + + // Free this item and return + printf("%d ", item -> key); + return; +} + /**************************************************************************** * Public Interface Functions * @@ -157,46 +219,159 @@ ****************************************************************************/ // The createHashTable is provided for you as a starting point. HashTable* createHashTable(HashFunction hashFunction, unsigned int numBuckets) { - // The hash table has to contain at least one bucket. Exit gracefully if - // this condition is not met. + // The hash table has to contain at least one bucket. + // Exit gracefully if this condition is not met. if (numBuckets==0) { printf("Hash table has to contain at least 1 bucket...\n"); exit(1); } - + // Allocate memory for the new HashTable struct on heap. HashTable* newTable = (HashTable*)malloc(sizeof(HashTable)); - + // Initialize the components of the new HashTable struct. newTable->hash = hashFunction; newTable->num_buckets = numBuckets; newTable->buckets = (HashTableEntry**)malloc(numBuckets*sizeof(HashTableEntry*)); - + // As the new buckets are empty, init each bucket as NULL. unsigned int i; for (i=0; i<numBuckets; ++i) { newTable->buckets[i] = NULL; } - + // Return the new HashTable struct. return newTable; } - + void destroyHashTable(HashTable* hashTable) { - + + // Free every bucket in the hash table with freeBucket() + int j = 0; + while (j < (hashTable -> num_buckets)){ + freeBucket((hashTable -> buckets)[j]); + j++; + } + + // Delete the hash table itself + free(hashTable); + return; +} + +void printHashTable(HashTable* hashTable) { + // Free every bucket in the hash table with freeBucket() + int j = 0; + while (j < (hashTable -> num_buckets)){ + printBucket((hashTable -> buckets)[j]); + printf("\n"); + j++; + } + printf(" \n"); + return; } - + void* insertItem(HashTable* hashTable, unsigned int key, void* value) { + + // Create the entry and find its hash value + HashTableEntry* newItem = createHashTableEntry(key, value); + unsigned int hash = (hashTable -> hash)(key); + + // Go through the buckets + HashTableEntry* v; HashTableEntry* k; + int j = 0; int a = -1; + while (j < (hashTable -> num_buckets)){ + + // If a bucket is empty, put the new item in the bucket as its first entry + if ((hashTable -> buckets)[j] == NULL){ + if (a == -1) + a = j; + j++; + continue; + } + + // Find the bucket with the correct hash value + unsigned int hash1 = (hashTable -> hash)((hashTable -> buckets)[j] -> key); + if (hash == hash1){ + + k = (hashTable -> buckets)[j]; // k is the address of the first item of the bucket + + // Check if the first entry in a bucket has the same key + // If so, replace that entry and update the previous entry + if (key == (k -> key)){ + newItem -> next = k -> next; + (hashTable -> buckets)[j] = newItem; + return (k -> value); + } + // Check if other entries in the bucket has the same key + // If so, replace that entry and update the previous entry + // If not, add the new entry to the end of the linked list and update the previous entry + while ((k -> next) != NULL){ + if (key == ((k -> next) -> key)){ + newItem -> next = (k -> next) -> next; + v = k -> next; + k -> next = newItem; + return (v -> value); + } + k = (k -> next); + } + k -> next = newItem; + return NULL; + } + j++; + } + + (hashTable -> buckets)[a] = newItem; + return NULL; } - + void* getItem(HashTable* hashTable, unsigned int key) { - + + // Find the item and return its value + // If the item does not exist, return null + HashTableEntry* item = findItem(hashTable, key); + if (item == NULL){ + return NULL; + } + return(item -> value); } - + void* removeItem(HashTable* hashTable, unsigned int key) { - + unsigned int hash = (hashTable -> hash)(key); + HashTableEntry* v; HashTableEntry* k; void* val; + int j = 0; + while (j < (hashTable -> num_buckets)){ + if ((hashTable -> buckets)[j] == NULL){ + j++; + continue; + } + unsigned int hash1 = (hashTable -> hash)((hashTable -> buckets)[j] -> key); + if (hash == hash1){ + k = (hashTable -> buckets)[j]; // k is the address of the first item of the bucket + if (key == (k -> key)){ + (hashTable -> buckets)[j] = (k -> next); + val = (k -> value); + free(k); + return val; + } + while ((k -> next) != NULL){ + if (key == ((k -> next) -> key)){ + v = k -> next; + k -> next = (k -> next) -> next; + val = v -> value; + free(v); + return val; + } + k = (k -> next); + } + return NULL; + } + j++; + } + return NULL; } - + void deleteItem(HashTable* hashTable, unsigned int key) { - + void* val = removeItem(hashTable, key); + free(val); + return; } \ No newline at end of file
--- a/main.cpp Fri Oct 23 16:30:18 2020 -0400 +++ b/main.cpp Tue Nov 24 05:05:10 2020 +0000 @@ -14,13 +14,18 @@ #include "map.h" #include "graphics.h" #include "snake.h" - +#include "mbed.h" +//#include "wave_player.h" +#include "SDFileSystem.h" #include <math.h> #include<stdio.h> #define CITY_HIT_MARGIN 1 #define CITY_UPPER_BOUND (SIZE_Y-(LANDSCAPE_HEIGHT+MAX_BUILDING_HEIGHT)) - +int go_right(int x, int y); +int go_left(int x, int y); +int go_up(int x, int y); +int go_down(int x, int y); // Helper function declarations void playSound(char* wav); @@ -51,12 +56,28 @@ #define GO_DOWN 6 #define GAME_OVER 7 #define FULL_DRAW 8 +#define WON 9 +#define FOODN 10 +#define FOODS 11 +#define FOODW 12 +#define FOODE 13 + // Get Actions from User (push buttons & accelerometer) // Based on push button and accelerometer inputs, determine which action // needs to be performed (may be no action). int get_action(GameInputs inputs) { - return 0; + MapItem* N=get_north(snake.head_x,snake.head_y); + MapItem* S=get_south(snake.head_x,snake.head_y); + MapItem* W=get_east(snake.head_x, snake.head_y); + MapItem* E=get_west(snake.head_x, snake.head_y); + + if (E->type==WALL || N->type==WALL || S->type==WALL ||W->type==WALL) return GAME_OVER; + if (inputs.ay >= 0.20) return GO_UP; + if (inputs.ay < -0.20) return GO_DOWN; + if (inputs.ax < -0.20) return GO_LEFT; + if (inputs.ax >= 0.20) return GO_RIGHT; + else return NO_ACTION; } /** * Update the game state based on the user action. For example, if the user @@ -69,7 +90,96 @@ */ int update_game(int action) { - return 0; + + snake.head_px = snake.head_x; + snake.head_py = snake.head_y; + + switch(action) { + case GO_UP: + snake.head_y -= 1; + + for (int i = 1; i < snake.length-1; i++){ + int oldx = snake.head_px; + int oldy = snake.head_py; + int temx = snake.locations[i].x; + int temy = snake.locations[i].y; + snake.locations[i].x = oldx; + snake.locations[i].y = oldy; + oldx = temx; + oldy = temy;} + if (get_north(snake.head_x,snake.head_y)->type == GOODIE) + {map_erase(snake.head_x,snake.head_y-1); + return FULL_DRAW;} + break; + case GO_LEFT: + snake.head_x -= 1; + for (int i = 1; i < snake.length-1; i++){ + int oldx = snake.head_px; + int oldy = snake.head_py; + int temx = snake.locations[i].x; + int temy = snake.locations[i].y; + snake.locations[i].x = oldx; + snake.locations[i].y = oldy; + oldx = temx; + oldy = temy;} + if (get_west(snake.head_x-1,snake.head_y)->type == GOODIE) + {map_erase(snake.head_x,snake.head_y); + return FULL_DRAW;} + break; + + + case GO_DOWN: + snake.head_y += 1; + + for (int i = 1; i < snake.length-1; i++){ + int oldx = snake.head_px; + int oldy = snake.head_py; + int temx = snake.locations[i].x; + int temy = snake.locations[i].y; + snake.locations[i].x = oldx; + snake.locations[i].y = oldy; + oldx = temx; + oldy = temy;} + if (get_south(snake.head_x,snake.head_y+1)->type == GOODIE) + {map_erase(snake.head_x,snake.head_y); + return FULL_DRAW;} + break; + case GO_RIGHT: + snake.head_x += 1; + + for (int i = 1; i < snake.length-1; i++){ + int oldx = snake.head_px; + int oldy = snake.head_py; + int temx = snake.locations[i].x; + int temy = snake.locations[i].y; + snake.locations[i].x = oldx; + snake.locations[i].y = oldy; + oldx = temx; + oldy = temy;} + if (get_here(snake.head_x,snake.head_y)->type == GOODIE) + {add_nothing(snake.head_x,snake.head_y); + draw_snake_head(snake.head_x,snake.head_y); + snake.score= snake.score + 1;} + + break; + + case GAME_OVER: + + {uLCD.color(RED); + uLCD.cls(); + uLCD.text_width(3); + uLCD.text_height(3); + uLCD.printf("GAME\nOVER"); + uLCD.color(GREEN); + uLCD.text_width(1); + uLCD.text_height(1); + uLCD.printf("\n\n\n\n\nScore %d", snake.score); + uLCD.color(GREEN);} + while(1 == 1); + + } + return NO_RESULT; + } /** @@ -78,6 +188,7 @@ void draw_upper_status() { uLCD.line(0, 9, 127, 9, GREEN); + } /** @@ -112,7 +223,7 @@ { draw_border(); int u = 58; - int v = 56; + int v = 59; draw_snake_head(u, v); draw_snake_body(u-11, v); draw_snake_tail(u-22, v); @@ -170,6 +281,10 @@ */ void init_main_map() { + uLCD.text_width(1); + uLCD.text_height(1); + uLCD.printf("Score %d", snake.score); + uLCD.color(GREEN); // "Random" plants Map* map = set_active_map(0); for(int i = map_width() + 3; i < map_area(); i += 39) { @@ -194,7 +309,7 @@ add_wall(39, 0, VERTICAL, 10); pc.printf("Added!\r\n"); - + // Add stairs to chamber (map 1) //add_stairs(15, 5, 1, 5, 5); @@ -217,10 +332,11 @@ // 0. Initialize the maps -- implement this function: maps_init(); init_main_map(); + playSound("/sd/wavfiles/track.wav"); // Initialize game state set_active_map(0); - snake.head_x = snake.head_y = 5; + snake.head_x = snake.head_y = 5 ; // Initial drawing draw_game(FULL_DRAW); // Main game loop @@ -257,5 +373,5 @@ // Plays a wavfile void playSound(char* wav) { - + } \ No newline at end of file
--- a/map.cpp Fri Oct 23 16:30:18 2020 -0400 +++ b/map.cpp Tue Nov 24 05:05:10 2020 +0000 @@ -19,6 +19,8 @@ }; #define NUM_MAPS 1 +#define MAP_WIDTH 50 +#define MAP_HEIGHT 50 static Map maps[NUM_MAPS]; static int active_map; @@ -33,7 +35,9 @@ * This function should uniquely map (x,y) onto the space of unsigned integers. */ static unsigned XY_KEY(int X, int Y) { - // TODO: Fix me! + + return X*maps[0].h + Y; + } /** @@ -43,14 +47,14 @@ */ unsigned map_hash(unsigned key) { - // TODO: Fix me! + return key%(NUM_MAPS); } void maps_init() { - // TODO: Implement! - // Initialize hash table - // Set width & height + maps[0].items = createHashTable(map_hash, NUM_MAPS); + maps[0].w = MAP_WIDTH; + maps[0].h = MAP_HEIGHT; } Map* get_active_map() @@ -82,51 +86,51 @@ int map_width() { - + return get_active_map()->w; } int map_height() { - + return get_active_map()->h; } int map_area() { - + return map_width() * map_height(); } -MapItem* get_current(int x, int y) -{ - -} + MapItem* get_north(int x, int y) { - + return get_here(x, y-1); } + MapItem* get_south(int x, int y) { - + return get_here(x, y+1); } MapItem* get_east(int x, int y) { - + return get_here(x+1, y); } MapItem* get_west(int x, int y) { - + return get_here(x-1, y); } MapItem* get_here(int x, int y) { - + return (MapItem*) getItem(get_active_map()->items, XY_KEY(x, y)); } void map_erase(int x, int y) { - + MapItem* item = get_here(x, y); + if (item && item->data) + free(item->data); + deleteItem(get_active_map()->items, XY_KEY(x, y)); } - void add_wall(int x, int y, int dir, int len) { for(int i = 0; i < len; i++) @@ -207,3 +211,13 @@ void* val = insertItem(get_active_map()->items, XY_KEY(x, y), w1); if (val) free(val); // If something is already there, free it } +void add_nothing(int x, int y) +{ + MapItem* w1 = (MapItem*) malloc(sizeof(MapItem)); + w1->type = CLEAR; + w1->draw = draw_nothing; + w1->walkable = true; + w1->data = NULL; + void* val = insertItem(get_active_map()->items, XY_KEY(x, y), w1); + if (val) free(val); // If something is already there, free it +}
--- a/map.h Fri Oct 23 16:30:18 2020 -0400 +++ b/map.h Tue Nov 24 05:05:10 2020 +0000 @@ -1,4 +1,4 @@ -// Copyright 2020 Georgia Tech. All rights reserved. + // Copyright 2020 Georgia Tech. All rights reserved. // The materials provided by the instructor in this course are for // the use of the students currently enrolled in the course. // Copyrighted course materials may not be further disseminated. @@ -178,6 +178,6 @@ void add_snake_body(int x, int y); void add_snake_head(int x, int y); void add_snake_tail(int x, int y); - +void add_nothing(int x, int y); #endif //MAP_H \ No newline at end of file
--- a/snake.cpp Fri Oct 23 16:30:18 2020 -0400 +++ b/snake.cpp Tue Nov 24 05:05:10 2020 +0000 @@ -8,5 +8,14 @@ void snake_init (Snake * s) { - + s->head_x = 0; + s->head_px =0; + s->head_y = 0; + s->head_py =0; + s->length = 3; + + for (int i = 0; i < SNAKE_MAX_LENGTH; i++) + {s->locations[i].x = s->head_px; + s->locations[i].y = s->head_py;} + s->score = 0; //Current score of the snake }
--- a/speech.cpp Fri Oct 23 16:30:18 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#include "speech.h" - -#include "globals.h" -#include "hardware.h" - -/** - * Draw the speech bubble background. - */ -static void draw_speech_bubble(); - -/** - * Erase the speech bubble. - */ -static void erase_speech_bubble(); - -/** - * Draw a single line of the speech bubble. - * @param line The text to display - * @param which If TOP, the first line; if BOTTOM, the second line. - */ -#define TOP 0 -#define BOTTOM 1 -static void draw_speech_line(const char* line, int which); - -void draw_speech_bubble() -{ - -} - -void erase_speech_bubble() -{ - -} - -void draw_speech_line(const char* line, int which) -{ - -} - -void speech_bubble_wait() -{ - -} - -void speech(const char* line1, const char* line2) -{ - -} - -void long_speech(const char* lines[], int n) -{ - -}
--- a/speech.h Fri Oct 23 16:30:18 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -#ifndef SPEECH_H -#define SPEECH_H - -/** - * Display a speech bubble. - */ -void speech(const char* line1, const char* line2); - -/** - * Display a long speech bubble, with scrolling. - * - * @param lines The actual lines of text to display - * @param n The number of lines to display. - */ -void long_speech(const char* lines[], int n); - -#endif // SPEECH_H \ No newline at end of file