Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
sprite_2d.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
9#include "drawable_2d.hpp"
10
11namespace rendering_engine
12{
13class Scene;
14/**
15 * @class Sprite2D
16 * @brief 2D drawable component for rendering textured quad.
17 *
18 * @note Not copyable or assignable.
19 * @see Quad2D, Drawable2D, DrawableComponent, SceneComponent2D, Camera2D
20 */
22{
23public:
24 /**
25 * @brief Constructs the Sprite2D with a render context.
26 * @param renderContext Resource context.
27 *
28 */
29 Sprite2D(RenderResourceContext renderContext, Scene& scene, std::string textureName);
30
31 /**
32 * @copydoc DrawableComponent::Initialize
33 */
34 void Initialize() override;
35
36 /**
37 * @copydoc DrawableComponent::Update
38 */
39 void Update(float deltaTime) override;
40
41 /**
42 * @copydoc Drawable2D::Draw
43 */
44 void Draw(const Camera2D& camera) override;
45
46 /**
47 * @brief Sets a uniform scale relative to the sprite's texture size.
48 *
49 * The scale factor is applied to the original texture dimensions,
50 * allowing convenient uniform resizing of the sprite.
51 *
52 * @param scale Uniform scale factor (1.0 = original texture size).
53 */
54 void SetSpriteScale(float scale);
55
56 Sprite2D(const Sprite2D& rhs) = delete;
57 Sprite2D& operator=(const Sprite2D& rhs) = delete;
58
59protected:
60 std::string mTextureName;
62};
63
64} // namespace rendering_engine
Represents a 2D camera with position, rotation, and zoom control.
Definition: camera_2d.hpp:36
2D drawable component for rendering objects in 2D space.
Definition: drawable_2d.hpp:27
Base class representing a renderable scene.
Definition: scene.hpp:44
2D drawable component for rendering textured quad.
Definition: sprite_2d.hpp:22
Sprite2D(const Sprite2D &rhs)=delete
Sprite2D & operator=(const Sprite2D &rhs)=delete
glm::vec2 mTextureRespectiveScale
Definition: sprite_2d.hpp:61
#define RE_API
Aggregates pointers to global rendering resource managers.