Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Console::PutCharExt(unsigned char c, int fore_color, int back_color)
- {
- uint8_t chr = (uint8_t)c;
- if (c == '\n')
- {
- this->cursor_y += 1;
- this->cursor_x = 0;
- }
- else if (c == '\r')
- {
- this->cursor_x = 0;
- }
- else if (c == '\b')
- {
- if (this->cursor_x <= 0)
- {
- this->cursor_y -= 1;
- this->cursor_x = this->console_w - 1;
- }
- else
- {
- this->cursor_x -= 1;
- }
- }
- else if (c == '\7')
- {
- this->PlayBell();
- }
- else if (c == '\t')
- {
- int n = 8 - (this->cursor_x % 8);
- for (int i = 0; i < n; i++)
- {
- /* Don't exceed beyond screen width */
- this->PutCharExt(' ', fore_color, back_color);
- }
- }
- else
- {
- this->PlaceChar(this->cursor_x, this->cursor_y, chr, fore_color, back_color);
- /* Set cursor shadow, this is what creates the cursor "burn in" effect */
- this->cursor_shadow_width = this->font_w * 2;
- this->cursor_x += 1;
- }
- /* Wrap around */
- if (this->cursor_x >= this->console_w)
- {
- if (this->wrap_around)
- {
- this->cursor_x = 0;
- this->cursor_y += 1;
- }
- else
- {
- this->cursor_x--;
- }
- }
- if (this->cursor_y >= this->console_h)
- {
- while(!(this->cursor_y < this->console_h))
- this->Scroll();
- }
- /* Keep cursor in bounds */
- this->LimitCursor();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement