12 : AScene(assignedId), m_renderer(renderer)
14 auto ®istry = AScene::getRegistry();
16 registry.onComponentAdded(
17 [&renderer, ®istry](
const ecs::Entity e,
const std::type_info &type)
19 const auto *colorComp = registry.getComponent<
ecs::Color>(e);
20 const auto *fontComp = registry.getComponent<
ecs::Font>(e);
21 const auto *textComp = registry.getComponent<
ecs::Text>(e);
26 if (textComp && transform && fontComp)
28 renderer->createFont(fontComp->
id, fontComp->path);
30 {.font_name = fontComp->
id,
31 .color = {.r = colorComp->r, .g = colorComp->g, .b = colorComp->b, .a = colorComp->a},
32 .content = textComp->content,
33 .size = textComp->font_size,
36 .name = textComp->
id});
42 registry.createEntity()
44 .with<ecs::Transform>(
"transform_gameover", 150.F, 150.F, 0.F)
46 .with<ecs::Text>(
"gameover_text", std::string(
"GAME OVER"), 72U)
50 registry.createEntity()
52 .with<ecs::Transform>(
"transform_message", 150.F, 260.F, 0.F)
54 .with<ecs::Text>(
"message_text", std::string(
"Bande de Nuls"), 48U)
58 registry.createEntity()
60 .with<ecs::Transform>(
"transform_instruction", 150.F, 350.F, 0.F)
62 .with<ecs::Text>(
"instruction_text", std::string(
"Press ESC to return to menu"), 28U)