diff --git a/apps/chooser/chooser.c b/apps/chooser/chooser.c index a69f908..3d188a9 100644 --- a/apps/chooser/chooser.c +++ b/apps/chooser/chooser.c @@ -29,7 +29,7 @@ static void show_num (char ch, uint8_t count) buffer[1] = count / 10 + '0'; buffer[2] = count % 10 + '0'; buffer[3] = 0; - tinygl_text (buffer, tinygl_point (0, 0)); + tinygl_text (buffer); } @@ -45,7 +45,7 @@ int main (void) tinygl_text_speed_set (MESSAGE_RATE); tinygl_text_mode_set (TINYGL_TEXT_MODE_SCROLL); - tinygl_text ("NUM?", tinygl_point (0, 0)); + tinygl_text ("NUM?"); pacer_init (LOOP_RATE); diff --git a/apps/fonttest1/fonttest1.c b/apps/fonttest1/fonttest1.c index 9656fc0..ac4f3a3 100644 --- a/apps/fonttest1/fonttest1.c +++ b/apps/fonttest1/fonttest1.c @@ -43,7 +43,7 @@ static char show_char (char ch) string[0] = ch; string[1] = 0; - tinygl_text (string, tinygl_point (0, 0)); + tinygl_text (string); return ch; } diff --git a/apps/hello2/hello2.c b/apps/hello2/hello2.c index e462f81..c60b41e 100644 --- a/apps/hello2/hello2.c +++ b/apps/hello2/hello2.c @@ -27,7 +27,7 @@ int main (void) tinygl_font_set (&font5x7_1); tinygl_text_speed_set (MESSAGE_RATE); - tinygl_text ("HELLO WORLD", tinygl_point (0, 0)); + tinygl_text ("HELLO WORLD"); pacer_init (LOOP_RATE); diff --git a/apps/hello3/hello3.c b/apps/hello3/hello3.c index cddc109..3cae5e2 100644 --- a/apps/hello3/hello3.c +++ b/apps/hello3/hello3.c @@ -28,7 +28,7 @@ int main (void) tinygl_text_speed_set (MESSAGE_RATE); tinygl_text_mode_set (TINYGL_TEXT_MODE_SCROLL); - tinygl_text ("HELLO WORLD", tinygl_point (0, 0)); + tinygl_text ("HELLO WORLD"); pacer_init (LOOP_RATE); diff --git a/apps/hello4/hello4.c b/apps/hello4/hello4.c index 3d9cf06..ff04d82 100644 --- a/apps/hello4/hello4.c +++ b/apps/hello4/hello4.c @@ -31,7 +31,7 @@ int main (void) tinygl_text_speed_set (MESSAGE_RATE); tinygl_text_mode_set (TINYGL_TEXT_MODE_SCROLL); - tinygl_text ("HELLO WORLD", tinygl_point (0, 0)); + tinygl_text ("HELLO WORLD"); pacer_init (LOOP_RATE); diff --git a/apps/hello5/hello5.c b/apps/hello5/hello5.c index d51f7c8..dde6d41 100644 --- a/apps/hello5/hello5.c +++ b/apps/hello5/hello5.c @@ -32,7 +32,7 @@ int main (void) tinygl_text_mode_set (TINYGL_TEXT_MODE_SCROLL); tinygl_text_dir_set (TINYGL_TEXT_DIR_ROTATE); - tinygl_text ("HELLO WORLD ", tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text ("HELLO WORLD "); pacer_init (LOOP_RATE); diff --git a/apps/ir_grab1/ir_grab1.c b/apps/ir_grab1/ir_grab1.c index c09b3a5..3a56cf7 100644 --- a/apps/ir_grab1/ir_grab1.c +++ b/apps/ir_grab1/ir_grab1.c @@ -85,7 +85,7 @@ static void show_char (char ch) buffer[0] = ch; buffer[1] = 0; - tinygl_text (buffer, tinygl_point (0, 0)); + tinygl_text (buffer); } diff --git a/apps/ir_grab2/ir_grab2.c b/apps/ir_grab2/ir_grab2.c index 1d1834b..1f363da 100644 --- a/apps/ir_grab2/ir_grab2.c +++ b/apps/ir_grab2/ir_grab2.c @@ -89,7 +89,7 @@ static void show_char (char ch) buffer[0] = ch; buffer[1] = 0; - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -99,7 +99,7 @@ static void show_num (char ch, uint8_t num) buffer[0] = ch; uint8toa (num, buffer + 1, 0); - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } diff --git a/apps/ir_grab3/ir_grab3.c b/apps/ir_grab3/ir_grab3.c index 9469721..54f6d1f 100644 --- a/apps/ir_grab3/ir_grab3.c +++ b/apps/ir_grab3/ir_grab3.c @@ -156,7 +156,7 @@ int main (void) pacer_init (LOOP_RATE); - tinygl_text ("X", tinygl_point (0, 0)); + tinygl_text ("X"); led_set (LED1, 0); while (1) @@ -176,7 +176,7 @@ int main (void) if (seq != -1) { - tinygl_text (strings[seq], tinygl_point (0, 0)); + tinygl_text (strings[seq]); transmit (&codeseqs[seq * CODESEQ_LEN_MAX]); } @@ -199,7 +199,7 @@ int main (void) { if (capture (codeseq, CODESEQ_LEN_MAX)) { - tinygl_text ("?", tinygl_point (0, 0)); + tinygl_text ("?"); led_set (LED1, 1); state = STATE_STORE; break; @@ -227,7 +227,7 @@ int main (void) { memcpy (&codeseqs[seq * CODESEQ_LEN_MAX], codeseq, sizeof (codeseq)); codeseqs_write (codeseqs, CODESEQ_LEN_MAX, CODESEQ_NUM); - tinygl_text (strings[seq], tinygl_point (0, 0)); + tinygl_text (strings[seq]); led_set (LED1, 0); state = STATE_NORMAL; } diff --git a/apps/ir_serial_test1/ir_serial_test1.c b/apps/ir_serial_test1/ir_serial_test1.c index bc0dba0..4c9f62c 100644 --- a/apps/ir_serial_test1/ir_serial_test1.c +++ b/apps/ir_serial_test1/ir_serial_test1.c @@ -29,7 +29,7 @@ static void show_count (uint8_t count) buffer[0] = 'S'; buffer[1] = count + '0'; buffer[2] = 0; - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -40,7 +40,7 @@ static void show_err (uint8_t err) buffer[0] = 'E'; buffer[1] = err + '0'; buffer[2] = 0; - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } diff --git a/apps/ir_serial_test2/ir_serial_test2.c b/apps/ir_serial_test2/ir_serial_test2.c index c3d47d8..d73063d 100644 --- a/apps/ir_serial_test2/ir_serial_test2.c +++ b/apps/ir_serial_test2/ir_serial_test2.c @@ -28,7 +28,7 @@ static void show_count (uint8_t count) /* FIXME! */ buffer[0] = count + '0'; buffer[1] = 0; - tinygl_text (buffer, tinygl_point (0, 0)); + tinygl_text (buffer); } diff --git a/apps/ir_serial_test3/ir_serial_test3.c b/apps/ir_serial_test3/ir_serial_test3.c index 338fa78..4c06ca6 100644 --- a/apps/ir_serial_test3/ir_serial_test3.c +++ b/apps/ir_serial_test3/ir_serial_test3.c @@ -28,7 +28,7 @@ static void show_count (uint8_t count) /* FIXME! */ buffer[0] = count + '0'; buffer[1] = 0; - tinygl_text (buffer, tinygl_point (0, 0)); + tinygl_text (buffer); } diff --git a/apps/ir_uart_test1/ir_uart_test1.c b/apps/ir_uart_test1/ir_uart_test1.c index 6a818b5..11b9091 100644 --- a/apps/ir_uart_test1/ir_uart_test1.c +++ b/apps/ir_uart_test1/ir_uart_test1.c @@ -28,7 +28,7 @@ static void show_count (uint8_t count) /* FIXME! */ buffer[0] = count + '0'; buffer[1] = 0; - tinygl_text (buffer, tinygl_point (0, 0)); + tinygl_text (buffer); } diff --git a/apps/ir_uart_test2/ir_uart_test2.c b/apps/ir_uart_test2/ir_uart_test2.c index 54de957..e552167 100644 --- a/apps/ir_uart_test2/ir_uart_test2.c +++ b/apps/ir_uart_test2/ir_uart_test2.c @@ -27,7 +27,7 @@ static void show_char (char ch) buffer[0] = ch; buffer[1] = 0; - tinygl_text (buffer, tinygl_point (0, 0)); + tinygl_text (buffer); } diff --git a/apps/space10/space10.c b/apps/space10/space10.c index f0efd89..944b78a 100644 --- a/apps/space10/space10.c +++ b/apps/space10/space10.c @@ -86,7 +86,7 @@ game_over_display (char *buffer) *str++ = 'F'; uint8toa (spacey_shells_fired_get (), str, 0); tinygl_clear (); - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -99,7 +99,7 @@ game_text_display (uint8_t num, char *buffer, char *msg) *str++ = *msg++; uint8toa (num, str, 0); tinygl_clear (); - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -287,8 +287,7 @@ main (void) break; case STATE_INIT: - tinygl_text ("SPACEY READY V" VERSION " BY MPH ", - tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text ("SPACEY READY V" VERSION " BY MPH "); state = STATE_READY; break; diff --git a/apps/space11/space11.c b/apps/space11/space11.c index 8d1ec5a..df0457c 100644 --- a/apps/space11/space11.c +++ b/apps/space11/space11.c @@ -91,7 +91,7 @@ game_over_display (char *buffer) *str++ = '/'; uint8toa (spacey_shells_fired_get (), str, 0); tinygl_clear (); - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -104,7 +104,7 @@ game_text_display (uint8_t num, char *buffer, char *msg) *str++ = *msg++; uint8toa (num, str, 0); tinygl_clear (); - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -238,8 +238,7 @@ static void game_task (__unused__ void *data) break; case STATE_INIT: - tinygl_text ("SPACEY READY V" VERSION " BY MPH ", - tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text ("SPACEY READY V" VERSION " BY MPH "); state = STATE_READY; break; diff --git a/apps/space12/space12.c b/apps/space12/space12.c index 7efeef5..067fd40 100644 --- a/apps/space12/space12.c +++ b/apps/space12/space12.c @@ -152,7 +152,7 @@ game_over_display (char *buffer) *str++ = '/'; uint8toa (spacey_shells_fired_get (), str, 0); tinygl_clear (); - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -165,7 +165,7 @@ game_text_display (uint8_t num, char *buffer, char *msg) *str++ = *msg++; uint8toa (num, str, 0); tinygl_clear (); - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -304,8 +304,7 @@ static void game_task (__unused__ void *data) break; case STATE_INIT: - tinygl_text ("SPACEY READY V" VERSION " BY MPH ", - tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text ("SPACEY READY V" VERSION " BY MPH "); mmelody_play (melody, game_intro_tune); state = STATE_READY; break; diff --git a/apps/space9/space9.c b/apps/space9/space9.c index 7f05c01..b4ea453 100644 --- a/apps/space9/space9.c +++ b/apps/space9/space9.c @@ -87,7 +87,7 @@ game_over_display (char *buffer) *str++ = '/'; uint8toa (spacey_shells_fired_get (), str, 0); tinygl_clear (); - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -100,7 +100,7 @@ game_text_display (uint8_t num, char *buffer, char *msg) *str++ = *msg++; uint8toa (num, str, 0); tinygl_clear (); - tinygl_text (buffer, tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (buffer); } @@ -303,8 +303,7 @@ main (void) break; case STATE_INIT: - tinygl_text ("SPACEY READY V" VERSION " BY MPH ", - tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text ("SPACEY READY V" VERSION " BY MPH "); state = STATE_READY; break; diff --git a/apps/spacey_remote1/spacey_remote1.c b/apps/spacey_remote1/spacey_remote1.c index 68400b2..8e4f83a 100644 --- a/apps/spacey_remote1/spacey_remote1.c +++ b/apps/spacey_remote1/spacey_remote1.c @@ -38,7 +38,7 @@ int main (void) pacer_init (LOOP_RATE); - tinygl_text ("#", tinygl_point (0, 0)); + tinygl_text ("#"); /* Paced loop. */ while (1) @@ -69,11 +69,11 @@ int main (void) switch (event) { case SPACEY_EVENT_ALIEN_HIT: - tinygl_text ("*", tinygl_point (0, 0)); + tinygl_text ("*"); break; case SPACEY_EVENT_ALIEN_LANDED: - tinygl_text ("@", tinygl_point (0, 0)); + tinygl_text ("@"); break; } diff --git a/apps/squeak3/squeak3.c b/apps/squeak3/squeak3.c index bd06bf6..56e5745 100644 --- a/apps/squeak3/squeak3.c +++ b/apps/squeak3/squeak3.c @@ -77,7 +77,7 @@ static void button_task_init (void) static void display_note (void) { tinygl_clear (); - tinygl_text (note_names[note], tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (note_names[note]); } diff --git a/apps/squeak4/squeak4.c b/apps/squeak4/squeak4.c index 2343434..e4636de 100644 --- a/apps/squeak4/squeak4.c +++ b/apps/squeak4/squeak4.c @@ -51,8 +51,7 @@ note_play (tweeter_t tweeter, tweeter_note_t note, uint8_t velocity) { tinygl_clear (); if (note != 0 && velocity != 0) - tinygl_text (note_names[note % 12], - tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text (note_names[note % 12]); tweeter_note_play (tweeter, note, velocity); } diff --git a/apps/task2/task2.c b/apps/task2/task2.c index 7cb7a32..76a18db 100644 --- a/apps/task2/task2.c +++ b/apps/task2/task2.c @@ -42,7 +42,7 @@ static void display_task_init (void) tinygl_text_mode_set (TINYGL_TEXT_MODE_SCROLL); tinygl_text_dir_set (TINYGL_TEXT_DIR_ROTATE); - tinygl_text ("HELLO WORLD ", tinygl_point (0, TINYGL_HEIGHT - 1)); + tinygl_text ("HELLO WORLD "); } diff --git a/apps/updown1/updown1.c b/apps/updown1/updown1.c index c80b280..4ba362d 100644 --- a/apps/updown1/updown1.c +++ b/apps/updown1/updown1.c @@ -23,7 +23,7 @@ static void show_count (uint8_t count) /* FIXME! */ buffer[0] = count + '0'; buffer[1] = 0; - tinygl_text (buffer, tinygl_point (0, 0)); + tinygl_text (buffer); } diff --git a/apps/updown2/updown2.c b/apps/updown2/updown2.c index 3ded2af..f72c070 100644 --- a/apps/updown2/updown2.c +++ b/apps/updown2/updown2.c @@ -24,7 +24,7 @@ static void show_count (uint8_t count) /* FIXME! */ buffer[0] = count + '0'; buffer[1] = 0; - tinygl_text (buffer, tinygl_point (0, 0)); + tinygl_text (buffer); } diff --git a/utils/tinygl.c b/utils/tinygl.c index 4c04f54..473713c 100644 --- a/utils/tinygl.c +++ b/utils/tinygl.c @@ -263,7 +263,7 @@ static void tinygl_text_advance (void) /** Display a message repeatedly. @param string null terminated message to display @param pos position on screen. */ -void tinygl_text (const char *string, tinygl_point_t pos) +void tinygl_draw_message (const char *string, tinygl_point_t pos) { tinygl.message_index = 0; tinygl.scroll_pos = 0; @@ -296,6 +296,19 @@ void tinygl_text (const char *string, tinygl_point_t pos) } +/** Display a message repeatedly. + @param string null terminated message to display. */ +void tinygl_text (const char *string) +{ + tinygl_point_t pos; + + pos.x = 0; + pos.y = (tinygl.dir == TINYGL_TEXT_DIR_ROTATE) ? TINYGL_HEIGHT - 1 : 0; + + tinygl_draw_message (string, pos); +} + + /** Set the message update speed. @param speed text advance speed (characters per 10 s). */ void tinygl_text_speed_set (uint8_t speed) diff --git a/utils/tinygl.h b/utils/tinygl.h index 5ee920a..43ba365 100644 --- a/utils/tinygl.h +++ b/utils/tinygl.h @@ -136,12 +136,6 @@ static inline tinygl_point_t tinygl_point (tinygl_coord_t x, tinygl_coord_t y) } -/** Display a message repeatedly. - @param string null terminated message to display - @param pos position on screen. */ -void tinygl_text (const char *string, tinygl_point_t pos); - - /** Set the message update speed. @param speed text advance speed (characters per 10 s). */ void tinygl_text_speed_set (uint8_t speed); @@ -176,6 +170,17 @@ tinygl_point_t tinygl_draw_char (char ch, tinygl_point_t pos); uint8_t tinygl_draw_string (const char *str, tinygl_point_t pos); +/** Display a message repeatedly. + @param string null terminated message to display + @param pos position on screen. */ +void tinygl_draw_message (const char *string, tinygl_point_t pos); + + +/** Display a message repeatedly. + @param string null terminated message to display. */ +void tinygl_text (const char *string); + + /** Draw point. @param pos coordinates of point @param pixel_value pixel value to draw point. */