3 changed files with 28 additions and 1 deletions
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
#include "SPANElement.h" |
||||
#include "../TextNode.h" |
||||
|
||||
std::unique_ptr<Component> SPANElement::render(const Node &node, int y, int windowWidth, int windowHeight) { |
||||
if (!node.children.empty()) { |
||||
TextNode *textNode = dynamic_cast<TextNode*>(node.children[0].get()); |
||||
if (textNode) { |
||||
return std::make_unique<TextComponent>(textNode->text, 0, y, 12, false, windowWidth, windowHeight); |
||||
} |
||||
} |
||||
return nullptr; |
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
#ifndef SPANELEMENT_H |
||||
#define SPANELEMENT_H |
||||
|
||||
#include "../../graphics/opengl/components/Component.h" |
||||
#include "../../graphics/opengl/components/TextComponent.h" |
||||
#include "../Node.h" |
||||
|
||||
class SPANElement { |
||||
public: |
||||
static std::unique_ptr<Component> render(const Node &node, int y, int windowWidth, int windowHeight); |
||||
}; |
||||
|
||||
#endif |
Loading…
Reference in new issue