> 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 22:07:29 up 7 days, 22:07, 1 user, load average: 0.41, 0.34, 0.28
This commit is contained in:
@ -26,7 +26,7 @@ void init_proc() {
|
|||||||
|
|
||||||
// load program here
|
// load program here
|
||||||
void naive_uload(PCB *pcb, const char *filename);
|
void naive_uload(PCB *pcb, const char *filename);
|
||||||
naive_uload(NULL, "/bin/nslider");
|
naive_uload(NULL, "/bin/bmp-test");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ void NDL_DrawRect(uint32_t *pixels, int x, int y, int w, int h) {
|
|||||||
int _y = (dev_h - h) / 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);
|
// 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 ++) {
|
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);
|
// 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);
|
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);
|
fwrite(pixels + NDL_SCREEN_IDX(x, y + i, screen_w, screen_h), 4, w, fp);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
int main() {
|
int main() {
|
||||||
NDL_Init(0);
|
NDL_Init(0);
|
||||||
int w, h;
|
int w, h;
|
||||||
void *bmp = BMP_Load("/share/pictures/projectn.bmp", &w, &h);
|
void *bmp = BMP_Load("/share/pictures/test.bmp", &w, &h);
|
||||||
assert(bmp);
|
assert(bmp);
|
||||||
NDL_OpenCanvas(&w, &h);
|
NDL_OpenCanvas(&w, &h);
|
||||||
NDL_DrawRect(bmp, 0, 0, w, h);
|
NDL_DrawRect(bmp, 0, 0, w, h);
|
||||||
|
Reference in New Issue
Block a user