> 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
 13:43:15 up 7 days, 13:43,  1 user,  load average: 0.36, 0.19, 0.12
This commit is contained in:
tracer-ics2023
2024-09-25 13:43:15 +08:00
committed by zzy
parent dcb75ac49b
commit 5ea810de0a

View File

@ -75,7 +75,6 @@ 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("screen size: %d %d\n", screen_w, screen_h);
}
void NDL_DrawRect(uint32_t *pixels, int x, int y, int w, int h) {
@ -87,9 +86,10 @@ void NDL_DrawRect(uint32_t *pixels, int x, int y, int w, int h) {
int dev_w, dev_h;
_get_screen(&dev_w, &dev_h);
int _x = x + (dev_w - x) / 2;
int _x = x + (dev_w - x) / 2;
int _y = y + (dev_h - y) / 2;
for (int i = 0; i < h; i ++) {
printf("log: pos %d %d\n", _x, _y + i);
fseek(fp, (dev_w * (_y + i) + _x) * sizeof(uint32_t), SEEK_SET);
fwrite(pixels + screen_w * (y + i) + x, sizeof(uint32_t), w, fp);
}