Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Debug stuffs
- #ifdef VERBOSE
- #define CNS_LENGTH 2048
- static char console[CNS_LENGTH];
- static uint16_t cns_offs = 0;
- void consolePrint(const char *format, ...){
- char str[512] = { 0 };
- va_list va;
- va_start(va, format);
- vsnprintf(str, 512, format, va);
- va_end(va);
- if (strlen(str) + cns_offs >= CNS_LENGTH) cns_offs = 0;
- sprintf(&console[cns_offs], "%s\n", str);
- cns_offs = strlen(console);
- }
- void drawConsole(){
- int y = 25;
- char* text = strtok (console, "\n");
- while (text != NULL){
- if (y > 520){
- y = 5;
- cns_offs = 0;
- }
- drawString(5, y, text);
- y += 20;
- text = strtok(NULL, "\n");
- }
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement