quakeforge/ruamoko/qwaq/qwaq-screen.r
Bill Currie d88a091fc6 [qwaq] Use protocols to distinguish object abilities
Well, that took a fair bit more than it should have to get working: had
to implement the protocol support in qfcc and engine-side ruamoko.
2020-03-02 15:22:54 +09:00

48 lines
635 B
R

#include "qwaq-curses.h"
#include "qwaq-screen.h"
@implementation Screen
+(Screen *) screen
{
return [[[self alloc] init] autorelease];
}
-init
{
if (!(self = [super init])) {
return nil;
}
window = stdscr;
rect = getwrect (window);
return self;
}
-add: obj
{
if ([obj conformsToProtocol: @protocol (Draw)]) {
[views addObject: obj];
}
if ([obj conformsToProtocol: @protocol (HandleEvent)]) {
[event_handlers addObject: obj];
}
return self;
}
-setBackground: (int) ch
{
wbkgd (window, ch);
wrefresh (window);
return self;
}
-handleEvent: (qwaq_event_t *) event
{
return self;
}
-draw
{
return self;
}
@end