Dawn/src/vn/conversation/vnconversation.c

46 lines
1.2 KiB
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "vnconversation.h"
void vnConversationInit(vnconversation_t *convo, font_t *font, texture_t *tex) {
vnTextBoxInit(&convo->textbox, font, tex);
queueInit(&convo->actionQueue);
}
queueaction_t * vnConversationAdd(vnconversation_t *conversation) {
queueaction_t *action;
vnconversationitemdata_t *data;
// Update action queue data item.
data = conversation->itemData + conversation->actionQueue.count;
data->conversation = conversation;
// Add to queue
action = queueAdd(&conversation->actionQueue);
action->data = data;
return action;
}
void vnConversationUpdate(vnconversation_t *convo, engine_t *engine) {
vnTextBoxUpdate(&convo->textbox, engine);
queueUpdate(&convo->actionQueue, engine);
}
void vnConversationRender(
vnconversation_t *convo, engine_t *engine, shader_t *shader
) {
vnTextBoxRender(&convo->textbox, shader,
0, engine->render.height - convo->textbox.height
);
}
void vnConversationDispose(vnconversation_t *convo) {
queueDispose(&convo->actionQueue);
vnTextBoxDispose(&convo->textbox);
}