summaryrefslogtreecommitdiff
path: root/src/scenes/resultView.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scenes/resultView.c')
-rw-r--r--src/scenes/resultView.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/scenes/resultView.c b/src/scenes/resultView.c
index b433bd0..033d17e 100644
--- a/src/scenes/resultView.c
+++ b/src/scenes/resultView.c
@@ -11,7 +11,7 @@ static const int BORDER = 2;
static const int SCROLL_SPEED = 10;
typedef struct {
- char *value;
+ SubmitionResult *value;
int scroll;
/// For the fun popping up effect
float scroll_up;
@@ -57,17 +57,20 @@ bool drawResultView(void *self) {
// DrawBackground();
Rectangle body = GetResultViewBodyRect(data->scroll_up);
DrawRecBordered(body, WHITE, COLORSCHEME_ORANGE, BORDER);
- DrawTextInRec(body, data->value,
+ DrawTextInRec(body, data->value->stdout,
GetMainFont(), 20, COLORSCHEME_BROWN, 3, &data->scroll);
return true;
}
void deinitResultView(void *self) {
TraceLog(LOG_INFO, "Deleting a result view");
+ ResultViewData *data = ((Scene *)self)->data;
+ if (data->value != NULL) FreeSunmitionResult(data->value);
+ free(data);
free((Scene *)self);
}
-Scene *CreateResultView(char *result) {
+Scene *CreateResultView(SubmitionResult *result) {
TraceLog(LOG_INFO, "Creating a main menu");
Scene *outp = malloc(sizeof(Scene));
outp->Draw = drawResultView;
@@ -80,6 +83,7 @@ Scene *CreateResultView(char *result) {
free(outp);
return NULL;
}
+
data->value = result;
data->scroll = 0;
data->scroll_up = 1;