2023-08-11 19:46:46 +00:00
|
|
|
#include "v4k.h"
|
|
|
|
|
|
|
|
int yes() {
|
|
|
|
return puts("yes"),1;
|
|
|
|
}
|
|
|
|
int no() {
|
|
|
|
return puts("no"),0;
|
|
|
|
}
|
|
|
|
int hi() {
|
|
|
|
return puts("hi"),1;
|
|
|
|
}
|
|
|
|
|
2023-09-16 12:35:20 +00:00
|
|
|
int run_bt(void *ud) {
|
|
|
|
bt_t *b = (bt_t*)ud;
|
|
|
|
int rc=bt_run(b);
|
|
|
|
printf("rc:%d\n", rc);
|
|
|
|
ui_notify("bt done", va("status: %d", rc));
|
|
|
|
return 0;
|
|
|
|
}
|
2023-08-11 19:46:46 +00:00
|
|
|
|
|
|
|
int main() {
|
2023-09-16 12:35:20 +00:00
|
|
|
window_create(50, WINDOW_SQUARE); // WINDOW_MSAA4);
|
2023-08-11 19:46:46 +00:00
|
|
|
window_title(__FILE__);
|
|
|
|
|
|
|
|
bt_addfun("yes", yes);
|
|
|
|
bt_addfun("no", no);
|
|
|
|
bt_addfun("hi", hi);
|
2023-09-16 12:35:20 +00:00
|
|
|
bt_t b = bt("bt1.ini", 0);
|
2023-08-11 19:46:46 +00:00
|
|
|
|
|
|
|
// game loop
|
2023-09-16 12:35:20 +00:00
|
|
|
while( window_swap() && !input(KEY_ESC) ) {
|
2023-08-11 19:46:46 +00:00
|
|
|
if( ui_panel("AI", 0) ) {
|
|
|
|
int choice = ui_buttons(2, "BT Run", "BT Reload");
|
2023-09-16 12:35:20 +00:00
|
|
|
if(choice == 1) thread(run_bt, &b);
|
2023-08-11 19:46:46 +00:00
|
|
|
if(choice == 2) b = bt("bt1.ini", 0);
|
|
|
|
ui_separator();
|
|
|
|
ui_bt(&b);
|
|
|
|
ui_panel_end();
|
|
|
|
}
|
|
|
|
|
2023-09-16 12:35:20 +00:00
|
|
|
font_print(va(FONT_TOP FONT_RIGHT "bt.node: %d bytes", (int)sizeof(bt_t)));
|
2023-08-11 19:46:46 +00:00
|
|
|
}
|
|
|
|
}
|