aboutsummaryrefslogtreecommitdiff
path: root/src/Rendering/Renderer.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2025-08-14 00:28:27 +0200
committerhachem <im@hachem.wtf>2025-08-14 00:28:27 +0200
commit2e246683df3b18e8e129adb0ada25be5f82f5b59 (patch)
treefa692b2a612d025ec2efa6d121e5068d68ef4d17 /src/Rendering/Renderer.h
parent13f2e940700b4451f6bff52eb1666475fd2de72c (diff)
[add]: Ability to switch render API
Diffstat (limited to 'src/Rendering/Renderer.h')
-rw-r--r--src/Rendering/Renderer.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/Rendering/Renderer.h b/src/Rendering/Renderer.h
index 3083c4c..61dae82 100644
--- a/src/Rendering/Renderer.h
+++ b/src/Rendering/Renderer.h
@@ -2,20 +2,12 @@
#include "VertexArray.h"
#include "Shader.h"
+
#include <glm/glm.hpp>
#include <memory>
namespace Donut
{
- template<typename T>
- using Scope = std::unique_ptr<T>;
-
- template<typename T, typename ... Args>
- constexpr Scope<T> CreateScope(Args&& ... args)
- {
- return std::make_unique<T>(std::forward<Args>(args)...);
- }
-
class RendererAPI
{
public:
@@ -39,8 +31,9 @@ namespace Donut
virtual void DrawIndexed(const std::shared_ptr<VertexArray>& vertexArray,
uint32_t indexCount = 0) = 0;
- inline static API GetAPI() { return s_API; }
- static Scope<RendererAPI> Create();
+ inline static API GetAPI() { return s_API; }
+ inline static void SetAPI(API api) { s_API = api; }
+ static std::unique_ptr<RendererAPI> Create();
private:
static API s_API;
};
@@ -84,7 +77,7 @@ namespace Donut
}
private:
- static Scope<RendererAPI> s_RendererAPI;
+ static std::unique_ptr<RendererAPI> s_RendererAPI;
};
class Renderer