summaryrefslogtreecommitdiffhomepage
path: root/src/rmlui/irodeo_rmlui_t.hpp
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-07-04 21:16:41 -0400
committerrealtradam <[email protected]>2023-07-04 21:16:41 -0400
commit8c2ef4e65b80aa6da080e68b64776d7c1a088d2d (patch)
tree0648d580050f0d916f30388f24933ef5d1d7762e /src/rmlui/irodeo_rmlui_t.hpp
parentf26149d554a6c473ec51b8c8f59af12f1bedea84 (diff)
downloadRodeoKit-rmlui.tar.gz
RodeoKit-rmlui.zip
initial non-working rmlui attemptrmlui
Diffstat (limited to 'src/rmlui/irodeo_rmlui_t.hpp')
-rw-r--r--src/rmlui/irodeo_rmlui_t.hpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/rmlui/irodeo_rmlui_t.hpp b/src/rmlui/irodeo_rmlui_t.hpp
new file mode 100644
index 0000000..43bdebe
--- /dev/null
+++ b/src/rmlui/irodeo_rmlui_t.hpp
@@ -0,0 +1,86 @@
+#pragma once
+
+// internal
+
+// external
+#include "RmlUi/Core.h"
+#include "RmlUi/Core/Platform.h"
+#include "RmlUi/Core/RenderInterface.h"
+#include "RmlUi/Core/SystemInterface.h"
+
+class SystemInterface_Rodeo : public Rml::SystemInterface {
+public:
+ double GetElapsedTime() override;
+};
+
+class RenderInterface_Rodeo : public Rml::RenderInterface {
+ public:
+
+ bool is_projecting = false;
+
+ RenderInterface_Rodeo();
+ ~RenderInterface_Rodeo();
+
+ // The viewport should be updated whenever the window size changes.
+ void SetViewport(int viewport_width, int viewport_height);
+
+ // Sets up OpenGL states for taking rendering commands from RmlUi.
+ void BeginFrame();
+ void EndFrame();
+
+ // -- Inherited from Rml::RenderInterface --
+
+ void RenderGeometry(
+ Rml::Vertex* vertices,
+ int num_vertices,
+ int* indices,
+ int num_indices,
+ Rml::TextureHandle texture,
+ const Rml::Vector2f& translation
+ ) override;
+
+ void EnableScissorRegion(bool enable) override;
+ void SetScissorRegion(int x, int y, int width, int height) override;
+
+ bool LoadTexture(
+ Rml::TextureHandle& texture_handle,
+ Rml::Vector2i& texture_dimensions,
+ const Rml::String& source
+ ) override;
+ bool GenerateTexture(
+ Rml::TextureHandle& texture_handle,
+ const Rml::byte* source,
+ const Rml::Vector2i& source_dimensions
+ ) override;
+ void ReleaseTexture(Rml::TextureHandle texture_handle) override;
+
+ void SetTransform(const Rml::Matrix4f* transform) override;
+
+ // Can be passed to RenderGeometry() to enable texture rendering without changing the bound texture.
+ static const Rml::TextureHandle TextureEnableWithoutBinding = Rml::TextureHandle(-1);
+
+ private:
+ //Rml::Matrix4f transform, projection;
+ //ProgramId transform_dirty_state = ProgramId::All;
+ //bool transform_active = false;
+
+ //enum class ScissoringState { Disable, Scissor, Stencil };
+ //ScissoringState scissoring_state = ScissoringState::Disable;
+
+ int viewport_width = 0;
+ int viewport_height = 0;
+
+};
+
+struct
+icpprodeo_rmlui_state
+{
+ RenderInterface_Rodeo render_interface;
+ SystemInterface_Rodeo system_interface;
+ Rml::Context *default_context;
+};
+
+struct irodeo_rmlui_document_data
+{
+ Rml::ElementDocument *document;
+};