| 35 | } |
| 36 | |
| 37 | void VideoConsole::Print(char c, uint8_t r, uint8_t g, uint8_t b){ |
| 38 | switch(c){ |
| 39 | case '\n': |
| 40 | cursorX = 0; |
| 41 | cursorY++; |
| 42 | break; |
| 43 | case '\b': |
| 44 | cursorX--; |
| 45 | if(cursorX < 0){ |
| 46 | cursorX = widthInCharacters - 1; |
| 47 | cursorY--; |
| 48 | if(cursorY < 0){ |
| 49 | cursorX = cursorY = 0; |
| 50 | } |
| 51 | } |
| 52 | break; |
| 53 | default: |
| 54 | characterBuffer[cursorY * widthInCharacters + cursorX] = {c, r, g, b}; |
| 55 | cursorX++; |
| 56 | break; |
| 57 | } |
| 58 | if(cursorX >= widthInCharacters){ |
| 59 | cursorX = 0; |
| 60 | cursorY++; |
| 61 | } |
| 62 | if(cursorY >= heightInCharacters) Scroll(); |
| 63 | } |
| 64 | |
| 65 | void VideoConsole::Clear(uint8_t r, uint8_t g, uint8_t b){ |
| 66 | memset(characterBuffer,0, widthInCharacters*heightInCharacters*sizeof(ConsoleCharacter)); |