Randall Kliman / Mbed 2 deprecated NEOPUNK

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers speech.cpp Source File

speech.cpp

00001 #include "speech.h"
00002 
00003 #include "globals.h"
00004 #include "hardware.h"
00005 
00006 /**
00007  * Draw the speech bubble background.
00008  */
00009 static void draw_speech_bubble();
00010 
00011 /**
00012  * Erase the speech bubble.
00013  */
00014 static void erase_speech_bubble();
00015 
00016 /**
00017  * Draw a single line of the speech bubble.
00018  * @param line The text to display
00019  * @param which If TOP, the first line; if BOTTOM, the second line.
00020  */
00021 #define TOP    0
00022 #define BOTTOM 1
00023 static void draw_speech_line(const char* line, int which);
00024 
00025 /**
00026  * Delay until it is time to scroll.
00027  */
00028 static void speech_bubble_wait();
00029 
00030 void draw_speech_bubble()
00031 {
00032     uLCD.line(0, 93, 128, 93, 0xff00e5);
00033     uLCD.line(0, 94, 128, 94, 0xff00e5);
00034     uLCD.filled_rectangle(0,95,127, 117,0x000000);
00035 }
00036 
00037 void erase_speech_bubble()
00038 {
00039     uLCD.filled_rectangle(0,93,127, 117,0x000000);
00040 }
00041 
00042 void draw_speech_line(const char* line, int which)
00043 {
00044     uLCD.locate(0,12+which);
00045     uLCD.printf(line);
00046 }
00047 
00048 void speech_bubble_wait()
00049 {
00050     wait(1.5);
00051 }
00052 
00053 void speech(const char* line1, const char* line2)
00054 {
00055     draw_speech_bubble();
00056     draw_speech_line(line1, TOP);
00057     draw_speech_line(line2, BOTTOM);
00058     speech_bubble_wait();
00059     //erase_speech_bubble();
00060 }
00061 
00062 void long_speech(const char* lines[], int n)
00063 {
00064 }