From 6f1386fa0dbd77f7030ff21a31e01a06b80fea60 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 2 Mar 2020 18:29:31 +0900 Subject: [PATCH] [qwaq] Test out acs chars and the classes Crashes due to flooding the command buffer, but otherwise works (with larger buffer). --- ruamoko/qwaq/qwaq-app.r | 7 ++++--- ruamoko/qwaq/qwaq-screen.r | 5 +++++ ruamoko/qwaq/qwaq-window.r | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ruamoko/qwaq/qwaq-app.r b/ruamoko/qwaq/qwaq-app.r index 28bf31126..619001b79 100644 --- a/ruamoko/qwaq/qwaq-app.r +++ b/ruamoko/qwaq/qwaq-app.r @@ -44,20 +44,21 @@ arp_end (void) r.xlen /= 2; r.ylen /= 2; wprintf (screen.window, "%d %d %d %d\n", r.xpos, r.ypos, r.xlen, r.ylen); + wprintf (screen.window, "%d\n", acs_char(ACS_HLINE)); + mvwaddch(screen.window, 4, 4, acs_char(ACS_HLINE)); wrefresh(screen.window); Window *w; [screen add: w=[[Window windowWithRect: r] setBackground: COLOR_PAIR (2)]]; - wprintf (w.window, "%d %d %d %d\n", r.xpos, r.ypos, r.xlen, r.ylen); + //wprintf (w.window, "%d %d %d %d\n", r.xpos, r.ypos, r.xlen, r.ylen); return self; } -run { + [screen draw]; do { arp_start (); - update_panels (); - doupdate (); get_event (&event); if (event.event_type != qe_none) { [self handleEvent: &event]; diff --git a/ruamoko/qwaq/qwaq-screen.r b/ruamoko/qwaq/qwaq-screen.r index e44c25481..be7400468 100644 --- a/ruamoko/qwaq/qwaq-screen.r +++ b/ruamoko/qwaq/qwaq-screen.r @@ -12,6 +12,8 @@ if (!(self = [super init])) { return nil; } + views = [[Array array] retain]; + event_handlers = [[Array array] retain]; window = stdscr; rect = getwrect (window); return self; @@ -42,6 +44,9 @@ -draw { + [views makeObjectsPerformSelector: @selector (draw)]; + update_panels (); + doupdate (); return self; } diff --git a/ruamoko/qwaq/qwaq-window.r b/ruamoko/qwaq/qwaq-window.r index 307f09dce..bf94b177d 100644 --- a/ruamoko/qwaq/qwaq-window.r +++ b/ruamoko/qwaq/qwaq-window.r @@ -81,6 +81,22 @@ -draw { + int x = 0, y = 0; + for (int i = ACS_ULCORNER; i <= ACS_STERLING; i++) { + int ch = acs_char (i); + if (ch) { + mvwaddch (window, x, y, ch); + } else { + mvwaddch (window, x, y, '.'); + } + if (++x >= rect.xlen) { + x = 0; + if (++y >= rect.ylen) { + break; + } + } + } + wrefresh(window); return self; } @end