Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const screen_width = 10;
- int current_text_pos = 0;
- char screen_buffer[screen_width];
- void clear_screen()
- {
- for(int i = 0; i < screen_width; i++) screen_buffer[i] = ' ';
- }
- void fill_screen_buffer(String text)
- {
- int buffer_pos = 0;
- if (current_text_pos + screen_width >= text.length)
- {
- for(int i = current_text_pos; i <= text.length; i++)
- {
- screen_buffer[buffer_pos] = text[i];
- buffer_pos++;
- }
- buffer_pos++; // space
- for(int i = 0; i < (current_text_pos + screen_width + text.length) - text.length - 1; i++)
- {
- screen_buffer[buffer_pos] = text[i];
- buffer_pos++;
- }
- } else {
- for(int i = current_text_pos; i < screen_width + current_text_pos; i++)
- {
- screen_buffer[buffer_pos] = text[i];
- buffer_pos++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement