diff options
author | dzwdz | 2023-08-14 18:51:07 +0200 |
---|---|---|
committer | dzwdz | 2023-08-14 18:51:07 +0200 |
commit | 642b5fb0007b64c77d186fcb018d571152ee1d47 (patch) | |
tree | 1c466461f3602d306be309a053edae558ef2568e /src/user/app/dvd/dvd.c | |
parent | 8050069c57b729c18c19b1a03ab6e4bf63b4735e (diff) |
reorganization: first steps
Diffstat (limited to 'src/user/app/dvd/dvd.c')
-rw-r--r-- | src/user/app/dvd/dvd.c | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/user/app/dvd/dvd.c b/src/user/app/dvd/dvd.c deleted file mode 100644 index a15b440..0000000 --- a/src/user/app/dvd/dvd.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <camellia/execbuf.h> -#include <camellia/syscalls.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <draw.h> - -#define eprintf(fmt, ...) fprintf(stderr, "vterm: "fmt"\n" __VA_OPT__(,) __VA_ARGS__) - -struct framebuf fb; -struct rect dirty; - -void draw_rect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t col) { - for (uint32_t i = 0; i < w; i++) { - for (uint32_t j = 0; j < h; j++) { - *((uint32_t*)(fb.b + fb.pitch * (y+j) + 4 * (x+i))) = col; - } - } - dirty_mark(&dirty, x, y); - dirty_mark(&dirty, x + w, y + h); -} - -int main(void) { - if (fb_setup(&fb, "/kdev/video/") < 0) { - eprintf("fb_setup error"); - return 1; - } - int dx = 2, dy = 2, x = 100, y = 100, w = 150, h = 70; - uint32_t col = 0x800000; - - for (;;) { - if (x + dx < 0 || (size_t)(x + dx + w) >= fb.width) dx *= -1; - if (y + dy < 0 || (size_t)(y + dy + h) >= fb.height) dy *= -1; - x += dx; - y += dy; - draw_rect(x, y, w, h, col++); - dirty_flush(&dirty, &fb); - _sys_sleep(1000 / 60); - } - - return 1; -} |