Writes a single char to the framebuffer. Takes care of special control characters, such as newlines and carriage returns.
(&mut self, c: char)
| 94 | /// Writes a single char to the framebuffer. Takes care of special control characters, such as |
| 95 | /// newlines and carriage returns. |
| 96 | fn write_char(&mut self, c: char) { |
| 97 | match c { |
| 98 | '\n' => self.newline(), |
| 99 | '\r' => self.carriage_return(), |
| 100 | c => { |
| 101 | let new_xpos = self.x_pos + font_constants::CHAR_RASTER_WIDTH; |
| 102 | if new_xpos >= self.width() { |
| 103 | self.newline(); |
| 104 | } |
| 105 | let new_ypos = |
| 106 | self.y_pos + font_constants::CHAR_RASTER_HEIGHT.val() + BORDER_PADDING; |
| 107 | if new_ypos >= self.height() { |
| 108 | self.clear(); |
| 109 | } |
| 110 | self.write_rendered_char(get_char_raster(c)); |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /// Prints a rendered char into the framebuffer. |
| 116 | /// Updates `self.x_pos`. |
nothing calls this directly
no test coverage detected