void draw_box(int x, int y, int width, int height, color24_t color) { if (x + width >= 96) { width = 96 - x; } pulse_set_draw_window(x, y, x + width - 1, y + height - 1); for (int i = 0; i < width * height; i++) { pulse_draw_point24(color); } }
void draw_box(int x,int y,int width, int height, color24_t color) { // Set the canvas dimensions to be a 4 x 4 box pulse_set_draw_window(x, y, x + width - 1, y + height - 1); // Draw pixels onto that canvas for (int i = 0; i < width * height; i++) pulse_draw_point24(color); }
// Write the message to the screen void update_server_ping_message() { // Draw a black box over the text area to clear it // There are other more effecient solutions pulse_set_draw_window(0,102, SCREEN_WIDTH, SCREEN_HEIGHT); for (int i = 0; i < 30 * SCREEN_WIDTH; i++) { pulse_draw_point24(COLOR_BLACK24); } pulse_render_text(&message_text_box, &message_text_widget); }
void draw_pixel( color24_t c, uint32_t x, uint32_t y ) { if (x >= VSCREEN_WIDTH || y >= VSCREEN_HEIGHT) return; x >>= VSCREEN_SHIFT; y >>= VSCREEN_SHIFT; pulse_set_draw_window(x, y, x, y); pulse_draw_point24(c); }
// Redraw bluetooth icon void update_bluetooth_icon(bool connected) { if(connected) { pulse_set_draw_window(0, 0, 19, 19); for(int i = 0; i < 400; i++) { pulse_draw_point24(COLOR_BLACK24); } } else { pulse_draw_image(IMAGE_BLUETOOTH_NO, 0, 0); } }
// Print the time to the screen to and set a timer to call // this function on the minute mark void update_time() { print_time_into_text_buffer(); // Draw a black box over the text area to clear it // There are other more effecient solutions pulse_set_draw_window(0,0, SCREEN_WIDTH, 30); for (int i = 0; i < 30 * SCREEN_WIDTH; i++) { pulse_draw_point24(COLOR_BLACK24); } pulse_render_text(&clock_text_box, &clock_text_widget); // Register a timer to update the time on the minute mark pulse_register_timer(60000 - current_time.tm_sec * 1000, &update_time, 0); }