SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Image.h
1#pragma once
2
3#include "spark/core/Component.h"
4
5#include <filesystem>
6
7namespace spark::core::components
8{
12 class Image final : public Component
13 {
14 DECLARE_SPARK_RTTI(Image, Component)
15 SPARK_ALLOW_PRIVATE_SERIALIZATION
16
17 public:
18 explicit Image(GameObject* parent)
19 : Component(parent) {}
20
21 explicit Image(GameObject* parent, std::filesystem::path path)
22 : Component(parent), m_path(std::move(path)) {}
23
24 void render() const override
25 {
26 //core::Renderer2D::DrawImage(m_path, gameObject()->transform()->position, core::Application::Instance()->window().size().castTo<float>());
27 }
28
29 private:
30 std::filesystem::path m_path;
31 std::optional<math::Vector2<float>> m_size;
32 };
33}
34
35IMPLEMENT_SPARK_RTTI(spark::core::components::Image)
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
A GameObject is any object in the game. It contains a list of components that provides functionality ...
Definition GameObject.h:26
A simple component to render an image.
Definition Image.h:13
void render() const override
Renders the component.
Definition Image.h:24