void putchar(char c) { if(c == '\n') { terminal_column = 0; advance_row(); } else if (c == '\b') { back(); }else { terminal_putentryat(c, terminal_color, terminal_column, terminal_row); advance_column(); } move_cursor_to(terminal_column, terminal_row); }
/* * Help text functions. */ static void update_help(int update_all) { char buf[200]; if (resuming) snprintf(buf, 200, "%-22s", (can_use_escape) ? "Esc: Abort resume" : ""); else snprintf(buf, 200, "%-22s R: %s reboot after hibernating ", (can_use_escape) ? "Esc: Abort hibernating" : "", (suspend_action & (1 << SUSPEND_REBOOT)) ? "Disable":" Enable"); move_cursor_to(video_num_columns - strlen(buf), video_num_lines); printf("%s", buf); }
void setup() { Serial.begin(9600); Serial.println("Starting..."); delay(500); Serial.flush(); // There can be nasty leftover bits. initialize_screen(); initialize_sd_card(); initialize_joystick(); initialize_map(); // Want to start viewing window in the center of the map move_window( (map_box[current_map_num].W + map_box[current_map_num].E) / 2, (map_box[current_map_num].N + map_box[current_map_num].S) / 2); // with cursor in the middle of the window move_cursor_to( screen_map_x + display_window_width / 2, screen_map_y + display_window_height / 2); // Draw the initial screen and cursor first_time = 1; // Now initialize and enable the zoom buttons. pinMode(zoom_out_pin, INPUT); // Zoom out. digitalWrite(zoom_out_pin, HIGH); pinMode(zoom_in_pin, INPUT); // Zoom in. digitalWrite(zoom_in_pin, HIGH); // Initialize interrupt routines attached to zoom buttons. attachInterrupt(zoom_in_interrupt, handle_zoom_in, FALLING); attachInterrupt(zoom_out_interrupt, handle_zoom_out, FALLING); #ifdef DEBUG_MEMORY Serial.print("Available mem:"); Serial.println(AVAIL_MEM); #endif }
void move_cursor_by(int16_t dx, int16_t dy) { move_cursor_to(cursor_map_x + dx, cursor_map_y + dy); }
static void text_prepare_status_real(int printalways, int clearbar, int level, const char *msg) { int y, i; if (msg) strncpy(lastheader, msg, 512); if (console_loglevel >= SUSPEND_ERROR) { if (!(suspend_action & (1 << SUSPEND_LOGALL)) || level == SUSPEND_UI_MSG) printf("\n** %s\n", lastheader); return; } /* Remember where the cursor was */ if (cur_x != -1) update_cursor_pos(); /* Print version */ move_cursor_to(0, video_num_lines); printf("%s", software_suspend_version); /* Update help text */ update_help(0); /* Print header */ move_cursor_to((video_num_columns - 19) / 2, (video_num_lines / 3) - 3); printf("T U X O N I C E"); /* Print action */ y = video_num_lines / 3; move_cursor_to(0, y); /* Clear old message */ for (i = 0; i < video_num_columns; i++) printf(" "); move_cursor_to((video_num_columns - strlen(lastheader)) / 2, y); printf("%s", lastheader); if (draw_progress_bar) { /* Draw left bracket of progress bar. */ y++; move_cursor_to(video_num_columns / 4, y); printf("["); /* Draw right bracket of progress bar. */ move_cursor_to(video_num_columns - (video_num_columns / 4) - 1, y); printf("]"); if (clearbar) { /* Position at start of progress */ move_cursor_to(video_num_columns / 4 + 1, y); /* Clear bar */ for (i = 0; i < barwidth; i++) printf(" "); move_cursor_to(video_num_columns / 4 + 1, y); barposn = 0; } } if (cur_x == -1) { cur_x = 1; cur_y = y+2; } move_cursor_to(cur_x, cur_y); hide_cursor(); }