diff options
Diffstat (limited to 'uitest')
| -rw-r--r-- | uitest/test.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/uitest/test.c b/uitest/test.c new file mode 100644 index 0000000..93264dd --- /dev/null +++ b/uitest/test.c @@ -0,0 +1,65 @@ +#include <atari.h> +#include <stdio.h> +#include <conio.h> +#include <string.h> +#include "../src/screen.h" +#include "../src/edbox.h" + +void got_line(void) { + scr_print(SCR_CURR, edit_box); +} + +int main() { + char i, s; + char buf[40]; + + OS.color2 = 0xc2; + OS.color1 = 0x0e; + + scr_init(); + edbox_callback = got_line; + + /* + for(i = 0; i < 4; i++) { + sprintf(buf, "screen%d", i); + s = scr_create(buf, 0); + scr_set_topic(s + 1, "This is screen #%d."); + } + */ + + for(i = 0; i < 19; i++) { + sprintf(buf, "line %d\n", i); + scr_print(0, buf); + } + + scr_print(0, "Hold Start and press:\n"); + scr_print(0, "N: Create new screen, C: Close screen\n"); + scr_print(0, "1-7: Switch to screen (if exists).\n"); + scr_print(0, "To enter text, just start typing.\n"); + + while(1) { + if(OS.ch != 0xff) { + if(GTIA_READ.consol == 6) { /* start pressed */ + i = cgetc(); + if(i >= '1' && i <= '7') { + if(scr_active[i - '1'] != SCR_UNUSED) + scr_display(i - '1'); + } else if(i == 'n') { + s = scr_create("new screen", 1); + if(s != 0xff) { + scr_print(0, "Screen #"); + scr_putc(0, s + '1'); + scr_print(0, " created.\n"); + } else { + scr_print(scr_current, "Can't create screen (all in use)\n"); + } + } else if(i == 'c') { + scr_destroy(scr_current); + } + } else { + edbox_keystroke(); + } + } + } + return 0; +} |
