X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmain.c;h=d6ec65bc64fb4f542cfcd51724ed07408204c074;hb=2ba6401e39bcfaaccaa45e6b7ef780a7a15b0c48;hp=2323ea3eb8ffccb13dc9aaaa4bf3e4dd32fed9fa;hpb=5363ed21fccc528965a8482b3b71fe0133595499;p=oftp diff --git a/src/main.c b/src/main.c index 2323ea3..d6ec65b 100644 --- a/src/main.c +++ b/src/main.c @@ -1,22 +1,39 @@ #include "tgfx.h" #include "input.h" +#include "tui.h" +#include "ftp.h" + +struct ftp *ftp; +struct tui_widget *uilist; int main(void) { union event ev; + if(!(ftp = ftp_alloc())) { + return 1; + } + if(ftp_connect(ftp, "192.168.0.4", 21) == -1) { + ftp_free(ftp); + return 1; + } + init_input(); + tg_init(); + tg_bgchar(' '); tg_clear(); - tg_bgcolor(1); - tg_rect("Remote", 0, 0, 40, 23, TGFX_FRAME); - tg_rect("Local", 40, 0, 40, 23, TGFX_FRAME); + uilist = tui_list("Remote", 0, 0, 40, 23, 0, 0); + tui_add_list_item(uilist, "first item"); + tui_add_list_item(uilist, "second item"); + tui_add_list_item(uilist, "another item"); + tui_add_list_item(uilist, "foo"); - tg_fgcolor(7); - tg_text(0, 24, "fooolalala bar"); -/* tg_setcursor(2, 24);*/ + tg_setcursor(0, 24); + + tui_draw(uilist); while(wait_input(&ev)) { switch(ev.type) { @@ -30,11 +47,10 @@ int main(void) } done: - tg_bgchar(' '); - tg_bgcolor(0); - tg_fgcolor(7); - tg_clear(); + tg_cleanup(); cleanup_input(); + + ftp_free(ftp); return 0; }