From 62b5f953677addeebac38ab6774599bbbab130f0 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 20 May 2006 16:34:34 +0000 Subject: Add main loop function and forward key presses to widgets. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 490 --- textscreen/txt_desktop.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'textscreen/txt_desktop.c') diff --git a/textscreen/txt_desktop.c b/textscreen/txt_desktop.c index a2ec5c56..4cfe30a0 100644 --- a/textscreen/txt_desktop.c +++ b/textscreen/txt_desktop.c @@ -131,3 +131,30 @@ void TXT_DrawDesktop(void) TXT_UpdateScreen(); } +void TXT_DispatchEvents(void) +{ + int c; + + while ((c = TXT_GetChar()) > 0) + { + if (c == 27) + exit(0); + + if (num_windows > 0) + { + // Send the keypress to the top window + + TXT_WindowKeyPress(all_windows[num_windows - 1], c); + } + } +} + +void TXT_GUIMainLoop(void) +{ + for (;;) + { + TXT_DispatchEvents(); + TXT_DrawDesktop(); + } +} + -- cgit v1.2.3