> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 20:38:58 up 7 days, 20:39,  1 user,  load average: 0.34, 0.24, 0.23
This commit is contained in:
tracer-ics2023
2024-09-25 20:38:58 +08:00
committed by zzy
parent 73c41ae2bf
commit 5d7c78bc5c

View File

@ -76,7 +76,7 @@ void NDL_OpenCanvas(int *w, int *h) {
_get_screen(&dev_w, &dev_h);
screen_w = (*w == 0 || *w > dev_w) ? dev_w : *w;
screen_h = (*h == 0 || *h > dev_h) ? dev_h : *h;
printf("NDL_OpenCanvas: %d,%d, dev %d,%d\n", screen_w, screen_h, dev_w, dev_h);
// printf("NDL_OpenCanvas: %d,%d, dev %d,%d\n", screen_w, screen_h, dev_w, dev_h);
}
void NDL_DrawRect(uint32_t *pixels, int x, int y, int w, int h) {
@ -90,9 +90,10 @@ void NDL_DrawRect(uint32_t *pixels, int x, int y, int w, int h) {
_get_screen(&dev_w, &dev_h);
int _x = (dev_w - w) / 2;
int _y = (dev_h - h) / 2;
printf("NDL_DrawRect: %d,%d, dev %d,%d, wh %d,%d, xy %d,%d\n", _x, _y, dev_w, dev_h, w, h, x, y);
for (int i = 0; i < h; i ++) {
printf("log:%d,%d, dev %d,%d, wh %d,%d, xy %d,%d\n", _x, _y + i, dev_w, dev_h, w, h, x, y);
fseek(fp, NDL_SCREEN_POS(_x, (_y + i), dev_w, dev_h), SEEK_SET);
// printf("log:%d,%d, dev %d,%d, wh %d,%d, xy %d,%d\n", _x, _y + i, dev_w, dev_h, w, h, x, y);
fseek(fp, NDL_SCREEN_POS(_x, _y + i, dev_w, dev_h), SEEK_SET);
fwrite(pixels + NDL_SCREEN_IDX(x, y + i, screen_w, screen_h), 4, w, fp);
}
fclose(fp);