From f2266b843959413277767a990bb9a9c5593f3489 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sun, 13 Jun 2021 13:47:33 +0500 Subject: Implemented basic RmlUi integration --- src/Rml.hpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/Rml.hpp (limited to 'src/Rml.hpp') 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 +#include + +#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); + +}; -- cgit v1.2.3 From 94b3b6b32bc8b996c9689fb89a381cf216353641 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Thu, 17 Jun 2021 01:56:25 +0500 Subject: Implemented main menu in Rml and improved RmlUi support --- src/Rml.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Rml.hpp') diff --git a/src/Rml.hpp b/src/Rml.hpp index 5815c3e..7b312c0 100644 --- a/src/Rml.hpp +++ b/src/Rml.hpp @@ -7,17 +7,21 @@ class RmlSystemInterface : public Rml::SystemInterface { double totalTime; - public: virtual double GetElapsedTime() override; virtual bool LogMessage(Rml::Log::Type type, const Rml::String& message) override; + virtual void SetClipboardText(const Rml::String& text) override; + + virtual void GetClipboardText(Rml::String& text) override; + inline void Update(double timeToUpdate) { totalTime += timeToUpdate; } + std::string clipboard; }; class RmlRenderInterface : public Rml::RenderInterface { -- cgit v1.2.3 From 8c033fff3d82d5f0e4c5d2eb3c5d10efc60ee851 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Fri, 18 Jun 2021 17:14:19 +0500 Subject: Implemented RmlFileInterface --- src/Rml.hpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/Rml.hpp') diff --git a/src/Rml.hpp b/src/Rml.hpp index 7b312c0..6e4d857 100644 --- a/src/Rml.hpp +++ b/src/Rml.hpp @@ -1,10 +1,15 @@ #pragma once +#include + #include #include +#include #include "Renderer.hpp" +class AssetTreeNode; + class RmlSystemInterface : public Rml::SystemInterface { double totalTime; public: @@ -58,3 +63,24 @@ public: void Update(unsigned int windowWidth, unsigned int windowHeight); }; + +class RmlFileInterface : public Rml::FileInterface { + struct AssetHandle { + std::string fileName; + unsigned long long filePos; + AssetTreeNode* assetPtr; + }; + std::map handles; +public: + + virtual Rml::FileHandle Open(const Rml::String& path) override; + + virtual void Close(Rml::FileHandle file) override; + + virtual size_t Read(void* buffer, size_t size, Rml::FileHandle file) override; + + virtual bool Seek(Rml::FileHandle file, long offset, int origin) override; + + virtual size_t Tell(Rml::FileHandle file) override; + +}; -- cgit v1.2.3