2020-03-03 12:30:47 +00:00
|
|
|
#include <Array.h>
|
2020-03-01 09:25:02 +00:00
|
|
|
#include "qwaq-curses.h"
|
|
|
|
#include "qwaq-screen.h"
|
|
|
|
|
|
|
|
@implementation Screen
|
|
|
|
+(Screen *) screen
|
|
|
|
{
|
|
|
|
return [[[self alloc] init] autorelease];
|
|
|
|
}
|
|
|
|
|
|
|
|
-init
|
|
|
|
{
|
2020-03-05 15:32:09 +00:00
|
|
|
if (!(self = [super initWithRect:getwrect (stdscr)])) {
|
2020-03-01 09:25:02 +00:00
|
|
|
return nil;
|
|
|
|
}
|
2020-03-06 02:53:40 +00:00
|
|
|
textContext = stdscr;
|
|
|
|
scrollok (textContext, 1);
|
2020-03-01 09:25:02 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-setBackground: (int) ch
|
|
|
|
{
|
2020-03-06 02:53:40 +00:00
|
|
|
wbkgd (textContext, ch);
|
2020-03-01 09:25:02 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-03-02 06:22:54 +00:00
|
|
|
-handleEvent: (qwaq_event_t *) event
|
|
|
|
{
|
2020-03-04 13:09:40 +00:00
|
|
|
if (event.what & qe_mouse) {
|
2020-03-05 15:32:09 +00:00
|
|
|
[self printf:"%04x %2d %2d %d %08x \r", event.what, event.mouse.x, event.mouse.y, event.mouse.click, event.mouse.buttons];
|
2020-03-04 13:09:40 +00:00
|
|
|
[self redraw];
|
2020-03-03 12:30:47 +00:00
|
|
|
}
|
2020-03-02 06:22:54 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-draw
|
|
|
|
{
|
2020-03-02 09:29:31 +00:00
|
|
|
update_panels ();
|
|
|
|
doupdate ();
|
2020-03-02 06:22:54 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-03-03 12:30:47 +00:00
|
|
|
-redraw
|
|
|
|
{
|
|
|
|
update_panels ();
|
2020-03-06 02:53:40 +00:00
|
|
|
wrefresh(textContext);
|
2020-03-03 12:30:47 +00:00
|
|
|
doupdate ();
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-printf: (string) fmt, ...
|
|
|
|
{
|
2020-03-06 02:53:40 +00:00
|
|
|
wvprintf (textContext, fmt, @args);
|
2020-03-03 12:30:47 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-addch: (int) ch atX: (int) x Y: (int) y
|
|
|
|
{
|
2020-03-06 02:53:40 +00:00
|
|
|
mvwaddch(textContext, x, y, ch);
|
2020-03-03 12:30:47 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-03-01 09:25:02 +00:00
|
|
|
@end
|