summaryrefslogtreecommitdiff
path: root/textscreen/guitest.c
diff options
context:
space:
mode:
authorSimon Howard2006-05-18 18:48:24 +0000
committerSimon Howard2006-05-18 18:48:24 +0000
commit978ddf539803405ab8fed17e21014ee1ae69fac8 (patch)
tree6f9cf3fe29ec11b9d7b008227061934fededc590 /textscreen/guitest.c
parentff6493e0efe1c7ea628d8a6b596f915d9c9764e1 (diff)
downloadchocolate-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.c88
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();
+
+ }
+}
+
+