Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
create_actor_2d_subobject.hpp
Go to the documentation of this file.
1// This file is part of the Rendering Engine project.
2// Author: Alexander Obzherin <alexanderobzherin@gmail.com>
3// Copyright (c) 2026 Alexander Obzherin
4// Distributed under the terms of the zlib License. See LICENSE.md for details.
5
6#pragma once
7
8#include "actor_2d.hpp"
9#include "scene.hpp"
10
11#include "rectangle_2d.hpp"
12#include "text_block_2d.hpp"
13
14namespace rendering_engine
15{
16template <>
17Rectangle2D* Actor2D::CreateSubobject<Rectangle2D>(Rectangle2D::Properties prop)
18{
19 auto rectangle2D = mScene.Spawn<Rectangle2D>(prop);
20 mWards.push_back(rectangle2D);
21 rectangle2D->UpdateOnTick(bUpdateOnTick);
22
23 return rectangle2D;
24}
25
26template <>
27TextBlock2D* Actor2D::CreateSubobject<TextBlock2D>(TextBlock2D::Properties prop)
28{
29 auto textBlock2D = mScene.Spawn<TextBlock2D>(prop);
30 mWards.push_back(textBlock2D);
31 textBlock2D->UpdateOnTick(bUpdateOnTick);
32
33 return textBlock2D;
34}
35} // namespace rendering_engine
2D drawable component for rendering rectangle.
T * Spawn(V arg)
Spawns and registers a drawable of type T.
2D drawable representing a block of rendered text.