Scene: Load text-areas from JSON
This commit is contained in:
@@ -83,9 +83,15 @@ void Scene::initialize()
|
|||||||
|
|
||||||
// Text
|
// Text
|
||||||
|
|
||||||
uint32_t text = createEntity("Text");
|
if (sceneJson.exists("text") && sceneJson.at("text").type() == ruc::Json::Type::Array) {
|
||||||
addComponent<TextAreaComponent>(text, "HelloWorld!", "assets/fnt/dejavu-sans", 0, 150, 3);
|
auto& texts = sceneJson.at("text").asArray().elements();
|
||||||
// addComponent<TextAreaComponent>(text, "@#$%^&*()qygij!", "assets/fnt/dejavu-sans-test", 0, 150, 3);
|
for (const auto& text : texts) {
|
||||||
|
uint32_t textEntity = loadEntity(text);
|
||||||
|
addComponent<TextAreaComponent>(textEntity);
|
||||||
|
auto& textAreaComponent = getComponent<TextAreaComponent>(textEntity);
|
||||||
|
text.getTo(textAreaComponent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ruc::info("Scene initialized");
|
ruc::info("Scene initialized");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user