#include #include extern font_t font88; #define MAX_X_GLYPHS 49 #define MAX_Y_GLYPHS 28 #define MAX_LINE_HISTORY 100 typedef struct { char myChar; char myColor; } ConsoleGlyph; ConsoleGlyph myConsoleScreen[MAX_X_GLYPHS * (MAX_Y_GLYPHS + MAX_LINE_HISTORY)] = {0}; ConsoleGlyph *visibleScreen; uint8_t CursorX = 0; uint8_t CursorY = 0; uint8_t ScrollLineValue = 0; void InitConsole( void ) { visibleScreen = myConsoleScreen; } void ScrollToLine( uint8_t targetLine ) { if (targetLine < MAX_LINE_HISTORY ) { ScrollLineValue = targetLine; visibleScreen = &myConsoleScreen[MAX_X_GLYPHS*targetLine]; } } void PrintChar( uint8_t X, uint8_t Y, char c, char color ) { if(X=MAX_X_GLYPHS) { Xi -= MAX_X_GLYPHS; Yi++; } visibleScreen[MAX_X_GLYPHS*Yi+Xi].myChar = temp; visibleScreen[MAX_X_GLYPHS*Yi+Xi].myColor = color; i++; if(str[i]==0) break; Xi++; } } } void RenderConsole( void ) { uint16_t colorGint; ConsoleGlyph *tempGlyph; //= &visibleScreen[MAX_X_GLYPHS*y+x]; for(int y=0; ymyChar != 0x00) { if(tempGlyph->myColor == 0) colorGint = C_BLACK; else if(tempGlyph->myColor == 1) colorGint = C_BLUE; else if(tempGlyph->myColor == 2) colorGint = C_RED; else if(tempGlyph->myColor == 3) colorGint = C_GREEN; else if(tempGlyph->myColor == 4) colorGint = C_WHITE; else colorGint = C_BLACK; dprint(2+x*8, y*8, colorGint, "%lc", tempGlyph->myChar ); } } dupdate(); } int main(void) { dfont(&font88); dclear(C_WHITE); /* unsigned char temp = 0; for(int y=0; y