summaryrefslogtreecommitdiffstats
path: root/src/Rml.hpp
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-06-13 10:47:33 +0200
committerLaG1924 <lag1924@gmail.com>2021-06-13 10:47:33 +0200
commitf2266b843959413277767a990bb9a9c5593f3489 (patch)
treef26e90e9f7ceb9be3c108eb5129305356ac8df3a /src/Rml.hpp
parentAdded RmlUi to CMakeLists.txt (diff)
downloadAltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.gz
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.bz2
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.lz
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.xz
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.zst
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.zip
Diffstat (limited to '')
-rw-r--r--src/Rml.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/Rml.hpp b/src/Rml.hpp
new file mode 100644
index 0000000..5815c3e
--- /dev/null
+++ b/src/Rml.hpp
@@ -0,0 +1,56 @@
+#pragma once
+
+#include <RmlUi/Core/SystemInterface.h>
+#include <RmlUi/Core/RenderInterface.h>
+
+#include "Renderer.hpp"
+
+class RmlSystemInterface : public Rml::SystemInterface {
+ double totalTime;
+
+public:
+
+ virtual double GetElapsedTime() override;
+
+ virtual bool LogMessage(Rml::Log::Type type, const Rml::String& message) override;
+
+ inline void Update(double timeToUpdate) {
+ totalTime += timeToUpdate;
+ }
+
+};
+
+class RmlRenderInterface : public Rml::RenderInterface {
+ RenderState* State;
+
+ GLuint Vao, Vbo, Ebo;
+
+public:
+
+ RmlRenderInterface(RenderState &renderState);
+
+ RmlRenderInterface(const RmlRenderInterface&) = delete;
+
+ RmlRenderInterface(RmlRenderInterface&&) = delete;
+
+ RmlRenderInterface& operator=(const RmlRenderInterface&) = delete;
+
+ RmlRenderInterface& operator=(RmlRenderInterface&&) = delete;
+
+ ~RmlRenderInterface();
+
+ virtual void RenderGeometry(Rml::Vertex* vertices, int num_vertices, int* indices, int num_indices, Rml::TextureHandle texture, const Rml::Vector2f& translation) override;
+
+ virtual void EnableScissorRegion(bool enable) override;
+
+ virtual void SetScissorRegion(int x, int y, int width, int height) override;
+
+ virtual bool LoadTexture(Rml::TextureHandle& texture_handle, Rml::Vector2i& texture_dimensions, const Rml::String& source) override;
+
+ virtual bool GenerateTexture(Rml::TextureHandle& texture_handle, const Rml::byte* source, const Rml::Vector2i& source_dimensions) override;
+
+ virtual void ReleaseTexture(Rml::TextureHandle texture) override;
+
+ void Update(unsigned int windowWidth, unsigned int windowHeight);
+
+};