[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.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];

View file

@ -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;
}

View file

@ -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