[qwaq] Test out acs chars and the classes

Crashes due to flooding the command buffer, but otherwise works (with
larger buffer).
This commit is contained in:
Bill Currie 2020-03-02 18:29:31 +09:00
parent b9ab30ff59
commit 6f1386fa0d
3 changed files with 25 additions and 3 deletions

View file

@ -44,20 +44,21 @@ arp_end (void)
r.xlen /= 2; r.xlen /= 2;
r.ylen /= 2; r.ylen /= 2;
wprintf (screen.window, "%d %d %d %d\n", r.xpos, r.ypos, r.xlen, r.ylen); 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); wrefresh(screen.window);
Window *w; Window *w;
[screen add: w=[[Window windowWithRect: r] setBackground: COLOR_PAIR (2)]]; [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; return self;
} }
-run -run
{ {
[screen draw];
do { do {
arp_start (); arp_start ();
update_panels ();
doupdate ();
get_event (&event); get_event (&event);
if (event.event_type != qe_none) { if (event.event_type != qe_none) {
[self handleEvent: &event]; [self handleEvent: &event];

View file

@ -12,6 +12,8 @@
if (!(self = [super init])) { if (!(self = [super init])) {
return nil; return nil;
} }
views = [[Array array] retain];
event_handlers = [[Array array] retain];
window = stdscr; window = stdscr;
rect = getwrect (window); rect = getwrect (window);
return self; return self;
@ -42,6 +44,9 @@
-draw -draw
{ {
[views makeObjectsPerformSelector: @selector (draw)];
update_panels ();
doupdate ();
return self; return self;
} }

View file

@ -81,6 +81,22 @@
-draw -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; return self;
} }
@end @end