Randall Kliman / Mbed 2 deprecated NEOPUNK

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Committer:
Sterofin
Date:
Fri Nov 30 02:53:05 2018 +0000
Revision:
2:06c63d567719
Parent:
0:35660d7952f7
doot

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rconnorlawson 0:35660d7952f7 1 #include "speech.h"
rconnorlawson 0:35660d7952f7 2
rconnorlawson 0:35660d7952f7 3 #include "globals.h"
rconnorlawson 0:35660d7952f7 4 #include "hardware.h"
rconnorlawson 0:35660d7952f7 5
rconnorlawson 0:35660d7952f7 6 /**
rconnorlawson 0:35660d7952f7 7 * Draw the speech bubble background.
rconnorlawson 0:35660d7952f7 8 */
rconnorlawson 0:35660d7952f7 9 static void draw_speech_bubble();
rconnorlawson 0:35660d7952f7 10
rconnorlawson 0:35660d7952f7 11 /**
rconnorlawson 0:35660d7952f7 12 * Erase the speech bubble.
rconnorlawson 0:35660d7952f7 13 */
rconnorlawson 0:35660d7952f7 14 static void erase_speech_bubble();
rconnorlawson 0:35660d7952f7 15
rconnorlawson 0:35660d7952f7 16 /**
rconnorlawson 0:35660d7952f7 17 * Draw a single line of the speech bubble.
rconnorlawson 0:35660d7952f7 18 * @param line The text to display
rconnorlawson 0:35660d7952f7 19 * @param which If TOP, the first line; if BOTTOM, the second line.
rconnorlawson 0:35660d7952f7 20 */
rconnorlawson 0:35660d7952f7 21 #define TOP 0
rconnorlawson 0:35660d7952f7 22 #define BOTTOM 1
rconnorlawson 0:35660d7952f7 23 static void draw_speech_line(const char* line, int which);
rconnorlawson 0:35660d7952f7 24
rconnorlawson 0:35660d7952f7 25 /**
rconnorlawson 0:35660d7952f7 26 * Delay until it is time to scroll.
rconnorlawson 0:35660d7952f7 27 */
rconnorlawson 0:35660d7952f7 28 static void speech_bubble_wait();
rconnorlawson 0:35660d7952f7 29
rconnorlawson 0:35660d7952f7 30 void draw_speech_bubble()
rconnorlawson 0:35660d7952f7 31 {
Sterofin 2:06c63d567719 32 uLCD.line(0, 93, 128, 93, 0xff00e5);
Sterofin 2:06c63d567719 33 uLCD.line(0, 94, 128, 94, 0xff00e5);
Sterofin 2:06c63d567719 34 uLCD.filled_rectangle(0,95,127, 117,0x000000);
rconnorlawson 0:35660d7952f7 35 }
rconnorlawson 0:35660d7952f7 36
rconnorlawson 0:35660d7952f7 37 void erase_speech_bubble()
rconnorlawson 0:35660d7952f7 38 {
Sterofin 2:06c63d567719 39 uLCD.filled_rectangle(0,93,127, 117,0x000000);
rconnorlawson 0:35660d7952f7 40 }
rconnorlawson 0:35660d7952f7 41
rconnorlawson 0:35660d7952f7 42 void draw_speech_line(const char* line, int which)
rconnorlawson 0:35660d7952f7 43 {
Sterofin 2:06c63d567719 44 uLCD.locate(0,12+which);
Sterofin 2:06c63d567719 45 uLCD.printf(line);
rconnorlawson 0:35660d7952f7 46 }
rconnorlawson 0:35660d7952f7 47
rconnorlawson 0:35660d7952f7 48 void speech_bubble_wait()
rconnorlawson 0:35660d7952f7 49 {
Sterofin 2:06c63d567719 50 wait(1.5);
rconnorlawson 0:35660d7952f7 51 }
rconnorlawson 0:35660d7952f7 52
rconnorlawson 0:35660d7952f7 53 void speech(const char* line1, const char* line2)
rconnorlawson 0:35660d7952f7 54 {
rconnorlawson 0:35660d7952f7 55 draw_speech_bubble();
rconnorlawson 0:35660d7952f7 56 draw_speech_line(line1, TOP);
rconnorlawson 0:35660d7952f7 57 draw_speech_line(line2, BOTTOM);
rconnorlawson 0:35660d7952f7 58 speech_bubble_wait();
Sterofin 2:06c63d567719 59 //erase_speech_bubble();
rconnorlawson 0:35660d7952f7 60 }
rconnorlawson 0:35660d7952f7 61
rconnorlawson 0:35660d7952f7 62 void long_speech(const char* lines[], int n)
rconnorlawson 0:35660d7952f7 63 {
rconnorlawson 0:35660d7952f7 64 }