#include "wrmr.h" #include "vui.h" int x = 0, y = 0; int dx = 0, dy = 0; int camx = 0, camy = 0; int C = '*'; unsigned frame = 0; int half_y = 0; int main(void) { vui_init(); int x = 0, y = 0; int scroll_x = 0, scroll_y = 0; for (;;) { static int last_left = 0; int left = (COLS - (72 < COLS ? 72 : COLS - 2)) >> 1; int right = COLS - left; int top = 5; int bottom = LINES - 5; //vui_fill(' ', FG_WHITE | BG_BLUE); //vui_fill_rect(' ', FG_BLACK | BG_BLACK, left + 2, top + 1, right - left, bottom - top); //vui_fill_rect(' ', FG_BLACK | BG_WHITE, left, top, right - left, bottom - top); if (y < top) { scroll_y = top - y; } if (y > bottom) { scroll_y = bottom - y; } scroll_x += left - last_left; last_left = left; int sdx = scroll_x > 0 ? 1 : (scroll_x < 0 ? -1 : 0); sdx = scroll_x; int sdy = scroll_y > 0 ? 1 : (scroll_y < 0 ? -1 : 0); vui_scroll(sdx, sdy); x += sdx; y += sdy; scroll_x -= sdx; scroll_y -= sdy; vui_blit(); int animating = !!scroll_x || !!scroll_y; if (animating && !vui_wait_for_input(50)) continue; VuiKey c = vui_key(); if (c == KEY_INVALID || c == KEY_ESC) goto done; if (x >= right) { x = left; y += 2; } static unsigned i = 0; i++; int tx = x + vui_aprintf(x, y - 1, (i & 1 ? FG_WHITE : FG_CYAN) | BG_BLACK, "%02X", c); vui_chra(x++, y, c < 0x20 || c > KEY_UTF8_MAX || c == 0x7f ? 0xfffd : c, FG_BYELLOW | BG_BLUE); while (x < tx) vui_chra(x++, y, ' ', FG_BYELLOW | BG_BLUE); } done: vui_fini(); return 0; }