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 08:25:19 +00:00
|
|
|
textContext = [TextContext screen];
|
|
|
|
[textContext scrollok: 1];
|
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 ();
|
2020-03-06 08:25:19 +00:00
|
|
|
[TextContext 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 08:25:19 +00:00
|
|
|
[textContext refresh];
|
|
|
|
[TextContext doupdate];
|
2020-03-03 12:30:47 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-03-06 08:25:19 +00:00
|
|
|
-setBackground: (int) ch
|
2020-03-03 12:30:47 +00:00
|
|
|
{
|
2020-03-06 08:25:19 +00:00
|
|
|
[textContext bkgd:ch];
|
2020-03-03 12:30:47 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-03-01 09:25:02 +00:00
|
|
|
@end
|