From 1e8dfa7388e3c0b44e375496e81afd338f6baf1c Mon Sep 17 00:00:00 2001 From: Dominic Masters Date: Sat, 12 Nov 2022 01:46:18 -0800 Subject: [PATCH] Writing some docs --- src/dawn/asset/AssetManager.hpp | 10 +++++ .../visualnovel/ui/VisualNovelTextbox.hpp | 43 +++++++++++++++++++ src/dawnpokergame/game/DawnGame.cpp | 5 ++- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/dawn/asset/AssetManager.hpp b/src/dawn/asset/AssetManager.hpp index baa22214..323100a8 100644 --- a/src/dawn/asset/AssetManager.hpp +++ b/src/dawn/asset/AssetManager.hpp @@ -14,7 +14,14 @@ namespace Dawn { std::map assetsNotLoaded; public: + /** + * Initializes this asset manager so it can begin accepting assets. + */ void init(); + + /** + * Ticks the asset manager for a single frame, synchronously. + */ void update(); /** @@ -43,6 +50,9 @@ namespace Dawn { //should delete the asset for you } + /** + * Dispose the asset manager, and all attached assets. + */ ~AssetManager(); }; } \ No newline at end of file diff --git a/src/dawn/visualnovel/ui/VisualNovelTextbox.hpp b/src/dawn/visualnovel/ui/VisualNovelTextbox.hpp index 074fe226..a5e5d441 100644 --- a/src/dawn/visualnovel/ui/VisualNovelTextbox.hpp +++ b/src/dawn/visualnovel/ui/VisualNovelTextbox.hpp @@ -44,12 +44,55 @@ namespace Dawn { Event<> eventAllCharactersRevealed; Event<> eventClose; + /** + * Constructs a VN Textbox. + * + * @param canvas Canvas that this textbox belongs to. + */ VisualNovelTextbox(UICanvas *canvas); + + /** + * Sets the font for this vn textbox. Passed to the underlying label. + * + * @param font Font to set for this textbox. + */ void setFont(Font *font); + + /** + * Sets the border information for this textbox. + * + * @param texture Texture to use for the border. + * @param dimensions Dimensions of the border. + */ void setBorder(Texture *texture, glm::vec2 dimensions); + + /** + * Sets the string (label) for this textbox. + * + * @param text Text to set. + * @param fontSize Font size of the string. + */ void setText(std::string text, float_t fontSize); + + /** + * Returns true if all of the characters that can be made visible for the + * current textbox size have finished revealing, or false if not. + * + * @return True if above statement is met. + */ bool_t hasRevealedAllCurrentCharacters(); + + /** + * Returns true only when every character passed previously in setText + * has been revealed by scrolling. + * + * @return True if above statement is true. + */ bool_t hasRevealedAllCharacters(); + + /** + * Cleans the VN Textbox. + */ ~VisualNovelTextbox(); }; } \ No newline at end of file diff --git a/src/dawnpokergame/game/DawnGame.cpp b/src/dawnpokergame/game/DawnGame.cpp index 9997a98a..f9052b61 100644 --- a/src/dawnpokergame/game/DawnGame.cpp +++ b/src/dawnpokergame/game/DawnGame.cpp @@ -43,10 +43,11 @@ int32_t DawnGame::init() { textbox->setFont(&assetFont->font); textbox->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus leo odio, egestas nec imperdiet ac, placerat eget quam. Nam tellus justo, aliquam sed porta quis, ullamcorper in libero. Proin auctor eget elit nec rutrum. Vestibulum tincidunt sem vel nisi sagittis, sed imperdiet eros aliquet. Fusce a ultrices augue, at auctor lacus. Sed lobortis, ante vitae vehicula egestas, lorem turpis cursus dui, sit amet egestas mauris ligula non ipsum. Pellentesque scelerisque posuere lorem sit amet tempor. Praesent ac hendrerit mi. Nulla mollis diam vitae vestibulum aliquam. Nullam metus justo, viverra sed risus eu, tincidunt sodales lacus. Quisque efficitur accumsan posuere. Aliquam posuere volutpat diam quis lacinia. Nullam blandit nulla vestibulum mi placerat varius. Proin egestas lacus nec pellentesque iaculis. Vestibulum ex metus, congue in eleifend et, scelerisque a nulla. Pellentesque cursus lectus sed arcu efficitur tincidunt. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nulla a felis non velit fermentum ullamcorper.", 40); textbox->setTransform( - UI_COMPONENT_ALIGN_START, UI_COMPONENT_ALIGN_START, - glm::vec4(100, 100, 300, 300), + UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END, + glm::vec4(0, 0, 0, 0), 0.0f ); + textbox return DAWN_GAME_INIT_RESULT_SUCCESS; }