3#include "spark/core/Application.h"
4#include "spark/core/components/Transform.h"
6#include "spark/math/Vector2.h"
7#include "spark/math/Vector4.h"
8#include "spark/rtti/HasRtti.h"
10namespace spark::core::components
28 :
Component(parent), size(std::move(size)), color(std::move(color)) {}
37 transform_matrix = glm::translate(transform_matrix, {size.x / 2.0f, size.y / 2.0f, 0.0f});
38 transform_matrix = glm::scale(transform_matrix, {size.x, size.y, 1.0f});
static Application * Instance()
Gets the instance of the application.
Definition Application.cpp:53
Window & window()
Gets the window for the application.
Definition Application.cpp:120
A component that can be attached to a GameObject to provide additional functionality.
Definition Component.h:20
Component(GameObject *parent)
Instantiates a new Component.
Definition Component.cpp:7
GameObject * gameObject()
Gets the GameObject that the component is attached to.
Definition Component.cpp:19
virtual void render() const
Renders the component.
Definition Component.h:59
A GameObject is any object in the game. It contains a list of components that provides functionality ...
Definition GameObject.h:26
components::Transform * transform() const
Gets the transform component of the GameObject.
Definition GameObject.cpp:63
Renderer2D< render::vk::VulkanBackend > & renderer() const
Gets the renderer of the window.
Definition Window.cpp:469
A simple component to render a square/rectangle.
Definition Rectangle.h:16
void render() const override
Renders the component.
Definition Rectangle.h:30
A vector with two components.
Definition Vector2.h:13
A vector with four components.
Definition Vector4.h:13