This commit is contained in:
2022-04-29 21:53:25 -07:00
parent 02b9c09c45
commit 768c73bba5
3 changed files with 22 additions and 3 deletions

View File

@@ -7,9 +7,27 @@
#include "questionbox.h" #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]; 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); conversationTextboxSetText(buffer);
} }

View File

@@ -19,6 +19,6 @@
extern uint8_t QUESTION_BOX_OPTION_COUNT; extern uint8_t QUESTION_BOX_OPTION_COUNT;
extern uint8_t QUESTION_BOX_OPTION_CURRENT; 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(); inline void questionBoxUpdate();

View File

@@ -20,6 +20,7 @@
#include "conversation/pause.h" #include "conversation/pause.h"
#include "conversation/queue.h" #include "conversation/queue.h"
#include "conversation/textbox.h" #include "conversation/textbox.h"
#include "conversation/questionbox.h"
#define GB_BACKGROUND_COLUMNS 0x20 #define GB_BACKGROUND_COLUMNS 0x20
#define GB_BACKGROUND_ROWS 0x20 #define GB_BACKGROUND_ROWS 0x20