diff --git a/src/conversation/questionbox.c b/src/conversation/questionbox.c index ca95c45..ef22df8 100644 --- a/src/conversation/questionbox.c +++ b/src/conversation/questionbox.c @@ -7,9 +7,27 @@ #include "questionbox.h" -void questionBoxSetOptions(char *title, char *options[QUESTION_BOX_OPTIONS_MAX]) { +uint8_t QUESTION_BOX_OPTION_COUNT; +uint8_t QUESTION_BOX_OPTION_CURRENT; + +void questionBoxSetOptions(char *title, char **options, uint8_t count) { + uint8_t i; char buffer[TEXTBOX_CHARS_MAX + 1]; - sprintf(buffer, "Hello World"); + sprintf(buffer, title); + + i = 0; + QUESTION_BOX_OPTION_CURRENT = 0; + QUESTION_BOX_OPTION_COUNT = count; + + // For each row... + for(i = 0; i < count; i++) { + if((i & 1) == 0) { + sprintf(buffer, "%s\n %s", buffer, options[i]); + } else { + sprintf(buffer, "%s %s", buffer, options[i]); + } + } + conversationTextboxSetText(buffer); } diff --git a/src/conversation/questionbox.h b/src/conversation/questionbox.h index e91376d..e0894ef 100644 --- a/src/conversation/questionbox.h +++ b/src/conversation/questionbox.h @@ -19,6 +19,6 @@ extern uint8_t QUESTION_BOX_OPTION_COUNT; extern uint8_t QUESTION_BOX_OPTION_CURRENT; -void questionBoxSetOptions(char *title, char *options[QUESTION_BOX_OPTIONS_MAX]); +void questionBoxSetOptions(char *title, char **options, uint8_t count); inline void questionBoxUpdate(); \ No newline at end of file diff --git a/src/main.h b/src/main.h index 669fe5d..1fc3597 100644 --- a/src/main.h +++ b/src/main.h @@ -20,6 +20,7 @@ #include "conversation/pause.h" #include "conversation/queue.h" #include "conversation/textbox.h" +#include "conversation/questionbox.h" #define GB_BACKGROUND_COLUMNS 0x20 #define GB_BACKGROUND_ROWS 0x20