Switched UI Label to use localized strings.

This commit is contained in:
2022-12-16 08:45:14 -08:00
parent b17592f4fd
commit 71dbf6e646
10 changed files with 70 additions and 43 deletions

View File

@ -9,15 +9,15 @@ using namespace Dawn;
VisualNovelTextboxEvent::VisualNovelTextboxEvent(
VisualNovelManager *manager,
std::string text
std::string key
) : IVisualNovelEvent(manager) {
this->text = text;
this->key = key;
}
void VisualNovelTextboxEvent::onStart(IVisualNovelEvent *previous) {
if(this->manager->textBox == nullptr) return;
this->manager->textBox->setText(this->text);
this->manager->textBox->setText(this->key);
this->manager->textBox->show();
this->hasSetText = true;
}
@ -26,7 +26,7 @@ bool_t VisualNovelTextboxEvent::onUpdate() {
if(this->manager->textBox == nullptr) return true;
if(!this->hasSetText) {
this->manager->textBox->setText(this->text);
this->manager->textBox->setText(this->key);
this->manager->textBox->show();
this->hasSetText = true;
}

View File

@ -9,7 +9,7 @@
namespace Dawn {
class VisualNovelTextboxEvent : public IVisualNovelEvent {
protected:
std::string text;
std::string key;
bool_t hasSetText = false;
void onStart(IVisualNovelEvent *previous) override;

View File

@ -147,14 +147,14 @@ void VisualNovelTextbox::setFont(Font *font) {
this->label.updateMesh();
}
void VisualNovelTextbox::setText(std::string text, float_t fontSize) {
this->label.setText(text);
void VisualNovelTextbox::setText(std::string key, float_t fontSize) {
this->label.setText(key);
this->label.setFontSize(fontSize);
this->label.updateMesh();
}
void VisualNovelTextbox::setText(std::string text) {
this->label.setText(text);
void VisualNovelTextbox::setText(std::string key) {
this->label.setText(key);
this->label.updateMesh();
}

View File

@ -70,17 +70,17 @@ namespace Dawn {
/**
* Sets the string (label) for this textbox.
*
* @param text Text to set.
* @param text Localized string key to set.
* @param fontSize Font size of the string.
*/
void setText(std::string text, float_t fontSize);
void setText(std::string key, float_t fontSize);
/**
* Sets the string (label) for this textbox.
*
* @param text Text to set.
* @param text Localized string key to set.
*/
void setText(std::string text);
void setText(std::string key);
/**
* Sets the font size to use.