From c2cccf6f2ef4f6f8c828074e68be2d95255a89b5 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 23 Aug 2020 15:49:22 +0200 Subject: Added bmp loading and other stuff --- apps/test.c | 8 ++------ apps/wm.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'apps') diff --git a/apps/test.c b/apps/test.c index dd85ffd..3bbe824 100644 --- a/apps/test.c +++ b/apps/test.c @@ -11,12 +11,8 @@ int main() struct message *msg = msg_receive_loop(); struct window *win = (struct window *)msg->data; - // TODO: Fix window transmitting - printf("\nReceived %d from %d\n", win->x, msg->src); - printf("Received %d from %d\n", win->y, msg->src); - printf("Received %d from %d\n", win->width, msg->src); - printf("Received %d from %d\n", win->height, msg->src); - printf("Received %d from %d\n", win->fb, msg->src); + const u32 color[3] = { 0xff, 0, 0 }; + gui_fill(win, color); while (1) { }; diff --git a/apps/wm.c b/apps/wm.c index 3984abc..97bab76 100644 --- a/apps/wm.c +++ b/apps/wm.c @@ -29,6 +29,7 @@ static struct window *new_window(int x, int y, u16 width, u16 height) win->y = y; win->width = width; win->height = height; + win->vbe = vbe; win->fb = malloc(width * height * (vbe->bpp >> 3)); return win; } @@ -44,11 +45,21 @@ int main(int argc, char **argv) const u32 color[3] = { 0, 0, 0 }; vesa_fill(vbe, color); gui_init("/font/spleen-16x32.psfu"); + gui_load_wallpaper(vbe, "/wall.bmp"); event_map(EVENT_KEYBOARD, onkey); + u32 last_time = 0; struct message *msg; while (1) { // TODO: Remove continuous polling? + /* u32 current_time = time(); */ + /* if (current_time - last_time > 1000 / 60) { // 60Hz */ + /* struct window *win = windows->head->data; */ + /* memcpy(vbe->fb, windows->head->data, */ + /* win->width * win->height * (vbe->bpp >> 3)); */ + /* } */ + /* last_time = current_time; */ + if (!(msg = msg_receive())) { yield(); continue; @@ -57,8 +68,9 @@ int main(int argc, char **argv) switch (msg->type) { case MSG_NEW_WINDOW: printf("New window for pid %d\n", msg->src); - struct window *win = new_window(50, 50, 200, 200); + struct window *win = new_window(0, 0, 200, 200); msg_send(msg->src, MSG_NEW_WINDOW, win); + list_add(windows, win); break; default: printf("Unknown WM request %d from pid %d", msg->type, msg->src); -- cgit v1.2.3