diff options
author | Marvin Borner | 2020-09-05 23:34:05 +0200 |
---|---|---|
committer | Marvin Borner | 2020-09-05 23:34:05 +0200 |
commit | b00d78697723eb3930a40125c02d328548946206 (patch) | |
tree | 8425f9c7c5e3d6b12c25b61f06b13b428a00c71a /apps | |
parent | 6938cb8093dc497160e24d8502cfc42a6adb1a6b (diff) |
Improved scheduler
Diffstat (limited to 'apps')
-rw-r--r-- | apps/mandelbrot.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/apps/mandelbrot.c b/apps/mandelbrot.c index 6eef9ef..a2be040 100644 --- a/apps/mandelbrot.c +++ b/apps/mandelbrot.c @@ -42,6 +42,9 @@ void draw_mandelbrot(struct window *win, int resolution) rand() << 16 | rand() << 8 | rand() | 0xff000000); else draw_pixel(win, col, row, 0xff000000); + + if (row % 50 == 0 && col == 0) + gui_redraw(); } } gui_redraw(); @@ -54,17 +57,11 @@ int main() struct window *win = gui_new_window(WF_DEFAULT); gui_fill(win, BG_COLOR); - event_register(EVENT_KEYBOARD); - int resolution = 0; - struct message *msg; + draw_mandelbrot(win, 50); + while (1) { - if (!(msg = msg_receive())) { - yield(); - continue; - } - if (msg->type == EVENT_KEYBOARD && ((struct event_keyboard *)msg->data)->press) - draw_mandelbrot(win, ++resolution); + yield(); }; return 0; |