diff options
author | Simon Howard | 2006-05-18 18:48:24 +0000 |
---|---|---|
committer | Simon Howard | 2006-05-18 18:48:24 +0000 |
commit | 978ddf539803405ab8fed17e21014ee1ae69fac8 (patch) | |
tree | 6f9cf3fe29ec11b9d7b008227061934fededc590 /textscreen/guitest.c | |
parent | ff6493e0efe1c7ea628d8a6b596f915d9c9764e1 (diff) | |
download | chocolate-doom-978ddf539803405ab8fed17e21014ee1ae69fac8.tar.gz chocolate-doom-978ddf539803405ab8fed17e21014ee1ae69fac8.tar.bz2 chocolate-doom-978ddf539803405ab8fed17e21014ee1ae69fac8.zip |
Initial working text-mode GUI framework.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 480
Diffstat (limited to 'textscreen/guitest.c')
-rw-r--r-- | textscreen/guitest.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/textscreen/guitest.c b/textscreen/guitest.c new file mode 100644 index 00000000..afa0a45a --- /dev/null +++ b/textscreen/guitest.c @@ -0,0 +1,88 @@ +#include <stdlib.h> + + +#include "txt_main.h" + +#include "txt_button.h" +#include "txt_separator.h" +#include "txt_window.h" + +txt_window_t *firstwin; + +void SetupWindow(void) +{ + txt_window_t *window; + char buf[100]; + int i; + + window = TXT_NewWindow("Window test", 40, 12); + + strcpy(buf, "This is a button label: "); + + { + txt_separator_t *sep; + sep = TXT_NewSeparator("Main Section"); + TXT_AddWidget(window, &sep->widget); + } + + for (i=0; i<8; ++i) + { + txt_button_t *button; + + button = TXT_NewButton(buf); + strcat(buf, "a"); + TXT_AddWidget(window, &button->widget); + + if (i == 4) + { + txt_separator_t *sep; + + sep = TXT_NewSeparator("Section"); + TXT_AddWidget(window, &sep->widget); + } + + if (i == 6) + { + txt_separator_t *sep; + + sep = TXT_NewSeparator(NULL); + TXT_AddWidget(window, &sep->widget); + } + } + + firstwin = window; +} + +void Window2(void) +{ + txt_window_t *window; + int i; + + window = TXT_NewWindow("Another test", 30, 7); + + for (i=0; i<5; ++i) + { + txt_button_t *button; + + button = TXT_NewButton("hello there blah blah blah blah"); + TXT_AddWidget(window, &button->widget); + } +} + +int main() +{ + TXT_Init(); + + Window2(); + SetupWindow(); + + for (;;) + { + firstwin->selected = (firstwin->selected + 1) % firstwin->num_widgets; + + TXT_DrawAllWindows(); + + } +} + + |