mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-07 16:31:32 +00:00
[qwaq] Clean up QwaqApplication
It doesn't need to be fun little tests any more.
This commit is contained in:
parent
1e56a8efbc
commit
e69c430abc
3 changed files with 37 additions and 34 deletions
|
@ -20,9 +20,11 @@
|
||||||
Extent screenSize;
|
Extent screenSize;
|
||||||
int autocount;
|
int autocount;
|
||||||
}
|
}
|
||||||
|
-(Extent)size;
|
||||||
|
-(TextContext *)screen;
|
||||||
-run;
|
-run;
|
||||||
-draw;
|
|
||||||
-handleEvent: (qwaq_event_t *) event;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@extern QwaqApplication *application;
|
||||||
|
|
||||||
#endif//__qwaq_app_h
|
#endif//__qwaq_app_h
|
||||||
|
|
|
@ -5,13 +5,8 @@ int fence;
|
||||||
|
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
#include "qwaq-app.h"
|
#include "qwaq-app.h"
|
||||||
#include "qwaq-button.h"
|
|
||||||
#include "qwaq-curses.h"
|
#include "qwaq-curses.h"
|
||||||
#include "qwaq-editor.h"
|
|
||||||
#include "qwaq-group.h"
|
#include "qwaq-group.h"
|
||||||
#include "qwaq-listener.h"
|
|
||||||
#include "qwaq-window.h"
|
|
||||||
#include "qwaq-screen.h"
|
|
||||||
#include "qwaq-view.h"
|
#include "qwaq-view.h"
|
||||||
|
|
||||||
static AutoreleasePool *autorelease_pool;
|
static AutoreleasePool *autorelease_pool;
|
||||||
|
@ -52,33 +47,19 @@ arp_end (void)
|
||||||
|
|
||||||
[screen bkgd: COLOR_PAIR (1)];
|
[screen bkgd: COLOR_PAIR (1)];
|
||||||
[screen scrollok: 1];
|
[screen scrollok: 1];
|
||||||
Rect r = {nil, screenSize};
|
[screen clear];
|
||||||
r.offset.x = r.extent.width / 4;
|
wrefresh (stdscr);//FIXME
|
||||||
r.offset.y = r.extent.height / 4;
|
|
||||||
r.extent.width /= 2;
|
|
||||||
r.extent.height /= 2;
|
|
||||||
Window *w;
|
|
||||||
[objects insertSelected: w = [[Window windowWithRect: r] setBackground: COLOR_PAIR (2)]];
|
|
||||||
r = {{1, 1}, {r.extent.width - 2, r.extent.height - 2}};
|
|
||||||
[w insertSelected: [[Editor alloc] initWithRect: r file: "Makefile"]];
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-run
|
-(Extent)size
|
||||||
{
|
{
|
||||||
[objects takeFocus];
|
return screenSize;
|
||||||
[self draw];
|
|
||||||
do {
|
|
||||||
arp_start ();
|
|
||||||
|
|
||||||
get_event (&event);
|
|
||||||
if (event.what != qe_none) {
|
|
||||||
[self handleEvent: &event];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arp_end ();
|
-(TextContext *)screen
|
||||||
} while (!endState);
|
{
|
||||||
return self;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
-draw
|
-draw
|
||||||
|
@ -116,17 +97,36 @@ arp_end (void)
|
||||||
[objects handleEvent: event];
|
[objects handleEvent: event];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-run
|
||||||
|
{
|
||||||
|
[objects takeFocus];
|
||||||
|
[self draw];
|
||||||
|
do {
|
||||||
|
arp_start ();
|
||||||
|
|
||||||
|
get_event (&event);
|
||||||
|
if (event.what != qe_none) {
|
||||||
|
[self handleEvent: &event];
|
||||||
|
}
|
||||||
|
|
||||||
|
arp_end ();
|
||||||
|
} while (!endState);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
QwaqApplication *application;
|
||||||
|
|
||||||
int main (int argc, string *argv)
|
int main (int argc, string *argv)
|
||||||
{
|
{
|
||||||
fence = 0;
|
fence = 0;
|
||||||
//while (!fence) {}
|
//while (!fence) {}
|
||||||
|
|
||||||
id app = [[QwaqApplication app] retain];
|
application = [[QwaqApplication app] retain];
|
||||||
|
|
||||||
[app run];
|
[application run];
|
||||||
[app release];
|
[application release];
|
||||||
qwaq_event_t event;
|
qwaq_event_t event;
|
||||||
get_event (&event); // XXX need a "wait for queue idle"
|
get_event (&event); // XXX need a "wait for queue idle"
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1731,8 +1731,9 @@ bi_i_TextContext__bkgd_ (progs_t *pr)
|
||||||
static void
|
static void
|
||||||
bi_i_TextContext__clear (progs_t *pr)
|
bi_i_TextContext__clear (progs_t *pr)
|
||||||
{
|
{
|
||||||
int window_id = P_STRUCT (pr, qwaq_textcontext_t, 0).window;
|
__auto_type self = &P_STRUCT (pr, qwaq_textcontext_t, 0);
|
||||||
int ch = P_INT (pr, 2);
|
int window_id = self->window;
|
||||||
|
int ch = self->background;
|
||||||
|
|
||||||
qwaq_werase (pr, window_id, ch);
|
qwaq_werase (pr, window_id, ch);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue