| 439 | } |
| 440 | |
| 441 | int main(int argc, char** argv){ |
| 442 | CreateFramebufferSurface(fbSurface); |
| 443 | renderSurface = fbSurface; |
| 444 | renderSurface.buffer = new uint8_t[fbSurface.width * fbSurface.height * 4]; |
| 445 | |
| 446 | wSize.ws_xpixel = renderSurface.width; |
| 447 | wSize.ws_ypixel = renderSurface.height; |
| 448 | |
| 449 | terminalFont = Lemon::Graphics::LoadFont("/initrd/sourcecodepro.ttf", "termmonospace"); |
| 450 | if(!terminalFont){ |
| 451 | terminalFont = Lemon::Graphics::GetFont("default"); |
| 452 | } |
| 453 | |
| 454 | wSize.ws_col = renderSurface.width / 8; |
| 455 | wSize.ws_row = renderSurface.height / terminalFont->height; |
| 456 | |
| 457 | InputManager input; |
| 458 | |
| 459 | for(int i = 0; i < wSize.ws_row; i++){ |
| 460 | screenBuffer.push_back(std::vector<TerminalChar>(wSize.ws_col)); |
| 461 | } |
| 462 | |
| 463 | syscall(SYS_GRANT_PTY, (uintptr_t)&masterPTYFd, 0, 0, 0, 0); |
| 464 | |
| 465 | setenv("TERM", "xterm-256color", 1); |
| 466 | ioctl(masterPTYFd, TIOCSWINSZ, &wSize); |
| 467 | |
| 468 | char* const args[] = {"/initrd/lsh.lef"}; |
| 469 | lemon_spawn(*args, 1, args, 1); |
| 470 | |
| 471 | char _buf[512]; |
| 472 | bool paint = true; |
| 473 | |
| 474 | for(;;){ |
| 475 | input.Poll(); |
| 476 | |
| 477 | while(int len = read(masterPTYFd, _buf, 512)){ |
| 478 | for(int i = 0; i < len; i++){ |
| 479 | PrintChar(_buf[i]); |
| 480 | } |
| 481 | paint = true; |
| 482 | } |
| 483 | |
| 484 | if(paint){ |
| 485 | Paint(); |
| 486 | } |
| 487 | } |
| 488 | } |
nothing calls this directly
no test coverage detected