/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include #include "../../display/primitive.h" #include "../../display/shader.h" #include "../../display/animation/timeline.h" #include "../../display/font.h" #include "../../display/primitives/quad.h" #include "../../input/input.h" #include "../../ui/frame.h" /** * Initializes the Visual Novel Text Box to its initial state. * * @param box The box to initialize. * @param font Font for the text box to use by default. * @param texture Texture for the GUI Frame Element. */ void vnTextBoxInit(vntextbox_t *box, font_t *font, texture_t *texture); /** * Sets just the text and does all necessary changes to the text. Set up your * text box how you like then use this to set just new texts moving forward. * @param box Box to modify. * @param text Text to set onto the textbox. */ void vnTextBoxSetText(vntextbox_t *box, char *text); /** * Method required to be called when changing anything within the textbox. This * will recalculate the text widths, fonts, etc. * @param box Box to recalculate for. */ void vnTextBoxRebuffer(vntextbox_t *box); /** * Updates the Visual Novel Text Box. This includes handling logic for both, * the animation and the input controlling for the textbox. * @param box Box to update. * @param engine Engine that the box is being updated by. */ void vnTextBoxUpdate(vntextbox_t *box, engine_t *engine); /** * Renders the Visual Novel Text Box. No logic occurs, just renders. Animations * will not be ticked, use update to do this. * @param box Box to render. * @param shader Shader to render to. */ void vnTextBoxRender(vntextbox_t *box, shader_t *shader); /** * Disposes a previously created Visual Novel Text Box. * @param box Text Box to dispose. */ void vnTextBoxDispose(vntextbox_t *box); /** * Checks the current buffer position of a vn text box and returns true if it has finished * scrolling. * * @param box Box to check. * @return True if the text box has finished scrolling. */ bool vnTextBoxHasScrolled(vntextbox_t *box); /** * Returns true when the next key press will cause the text box to close. For * cases when there's a line limit this would imply a user has visited all the * lines, for all other cases this would be when the text has finished the * scrolling. * * @param box Box to check. * @return True if the next accept input will close the text box. */ bool vnTextBoxCanBeClosed(vntextbox_t *box);