Engine
Raylib based game framework
Loading...
Searching...
No Matches
Renderer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Components.hpp"
4#include "Registry.hpp"
5#include "entt/entt.hpp"
6#include "raylib.h"
7
12
23class Renderer
24{
25public:
26
27 Camera2D camera;
28
38 static bool SetSprite(const Entity entity, const Component::Sprite& sprite);
39
47 static void RemoveSprite(const Entity entity);
48
60 void Init(Registry& registry, const float virtualWidth, const float virtualHeight);
61
62private:
63
64 Renderer(Registry& registry, const float virtualWidth, const float virtualHeight);
65
73 void Update(Registry& registry);
74
84 void Draw(Registry& registry) const;
85
89 void MarkNeedSort();
90
91 bool m_needSort = false;
92
93 float m_virtualWidth = 0;
94 float m_virtualHeight = 0;
95
96 friend class Engine;
97};
Engine components.
Engine entt::registry wrapper.
Wraps entt::registry with a safer, callback-aware API.
Definition Registry.hpp:29
void Init(Registry &registry, const float virtualWidth, const float virtualHeight)
Initialises the renderer and registers sprite change callbacks.
Definition Renderer.cpp:103
static void RemoveSprite(const Entity entity)
Removes the Sprite component from an entity.
Definition Renderer.cpp:31
static bool SetSprite(const Entity entity, const Component::Sprite &sprite)
Assigns or replaces the Sprite component on an entity.
Definition Renderer.cpp:10
Texture, source rectangle, tint, scale and render layer.
Definition Components.hpp:39