diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index c5c4b0f..87f8326 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -8,6 +8,22 @@ + + + diff --git a/assets/layout/base.rcss b/assets/layout/base.rcss index 3209ddc..3c5f394 100644 --- a/assets/layout/base.rcss +++ b/assets/layout/base.rcss @@ -5,7 +5,7 @@ hr, pre, tabset tabs { display: block; - background-color: white; + background-color: rgba(255, 255, 255, 0); color: black; font-family: Arial; } diff --git a/assets/layout/game.rcss b/assets/layout/game.rcss new file mode 100644 index 0000000..b4263bc --- /dev/null +++ b/assets/layout/game.rcss @@ -0,0 +1,20 @@ +.block { + display: flex; + flex-direction: row; + border: 2px outset; + + text-align: center; + align-items: center; + justify-content: center; +} + +.value { + width: 8em; + height: 2em; + + background-color: black; + color: white; + font-size: 16px; + border-color: #1d2749; + border-radius: 8px; +} \ No newline at end of file diff --git a/assets/layout/overlay/overlay.rcss b/assets/layout/overlay/overlay.rcss new file mode 100644 index 0000000..25f787b --- /dev/null +++ b/assets/layout/overlay/overlay.rcss @@ -0,0 +1,57 @@ +#header { + /*height: 32px;*/ + width: 100%; + display: flex; + flex-direction: row; + align-content: center; + + background-color: #151e3d; +} + +.stats { + display: flex; + flex-direction: row; + align-content: center; + padding: 8px; + gap: 8px; +} + +#calendar { + display: flex; + flex-direction: column; + margin-left: auto; + padding: 4px 8px 4px 4px; +} + +#speed-buttons { + display: flex; + flex-direction: row; + justify-content: space-between; +} + +.speed { + width: 1em; + height: 1em; + font-size: 14px; + background-color: #014269; + color: white; + border-radius: 2px; + border: 1px outset #1d2749; + text-align: center; +} + +#department-tabs { + position: absolute; + top: 50%; + transform: translateY(-50%); + + display: flex; + flex-direction: column; + gap: 8px +} + +.department { + height: 64px; + width: 128px; + background-color: blue; +} \ No newline at end of file diff --git a/assets/layout/overlay/overlay.rml b/assets/layout/overlay/overlay.rml new file mode 100644 index 0000000..aa08d15 --- /dev/null +++ b/assets/layout/overlay/overlay.rml @@ -0,0 +1,43 @@ + + + + + + + + + + + +
+
+
+
+
+
+
+ + +
\ No newline at end of file diff --git a/engine/src/UI.cpp b/engine/src/UI.cpp index 67772ae..f42dd2d 100644 --- a/engine/src/UI.cpp +++ b/engine/src/UI.cpp @@ -9,7 +9,7 @@ UI::UI(Rml::RenderInterface &renderer, const std::uint32_t width, const std::uin Rml::LoadFontFace("assets/fonts/ARIAL.TTF"); - currentDocument = context->LoadDocument("assets/layout/test/test.rml"); + currentDocument = context->LoadDocument("assets/layout/overlay/overlay.rml"); currentDocument->Show(); } diff --git a/engine/src/main.cpp b/engine/src/main.cpp index 70683d3..d486919 100644 --- a/engine/src/main.cpp +++ b/engine/src/main.cpp @@ -9,8 +9,8 @@ import VulkanRender; import GLFWInput; import std; -constexpr std::uint32_t SCREEN_WIDTH = 800; -constexpr std::uint32_t SCREEN_HEIGHT = 600; +constexpr std::uint32_t SCREEN_WIDTH = 1920; +constexpr std::uint32_t SCREEN_HEIGHT = 800; int main(int argc, char **argv) { // Setup P7 logger diff --git a/renderers/vulkan/modules/rml/rmlui_vulkan.cppm b/renderers/vulkan/modules/rml/rmlui_vulkan.cppm index d8e6d9f..8d728be 100644 --- a/renderers/vulkan/modules/rml/rmlui_vulkan.cppm +++ b/renderers/vulkan/modules/rml/rmlui_vulkan.cppm @@ -75,6 +75,8 @@ export namespace ee_rml { void SetScissorRegion(Rml::Rectanglei region) override; + void SetTransform(const Rml::Matrix4f *transform) override; + void SetFrameContext(vulkan_render::FrameContext *frameContext); private: @@ -84,6 +86,7 @@ export namespace ee_rml { vulkan_render::Sampler sampler; std::unordered_map textures; vulkan_render::RenderTexture defaultTexture; + glm::mat4 currentTransform = glm::mat4(1.0f); }; } \ No newline at end of file diff --git a/renderers/vulkan/src/rml/rmlui_vulkan.cpp b/renderers/vulkan/src/rml/rmlui_vulkan.cpp index 609e020..e36ff93 100644 --- a/renderers/vulkan/src/rml/rmlui_vulkan.cpp +++ b/renderers/vulkan/src/rml/rmlui_vulkan.cpp @@ -89,7 +89,7 @@ void ee_rml::RmlVulkan::RenderGeometry( .mvp = glm::ortho( 0.0f, static_cast(renderer.surface.extent.width), 0.0f, static_cast(renderer.surface.extent.height) - ), + ) * currentTransform, .translate = glm::vec2(translation.x, translation.y) }; @@ -166,6 +166,15 @@ void ee_rml::RmlVulkan::SetScissorRegion(const Rml::Rectanglei region) { renderer.pipeline.scissors.extent = {width, height}; } +void ee_rml::RmlVulkan::SetTransform(const Rml::Matrix4f *transform) { + if (transform != nullptr) { + std::memcpy(¤tTransform[0][0], transform->data(), sizeof(glm::mat4)); + } + else { + currentTransform = glm::mat4(1.0f); + } +} + void ee_rml::RmlVulkan::SetFrameContext(vulkan_render::FrameContext *frameContext) { this->frameContext = frameContext; } diff --git a/utils/modules/rml.cppm b/utils/modules/rml.cppm index 05272dd..7d9eb31 100644 --- a/utils/modules/rml.cppm +++ b/utils/modules/rml.cppm @@ -19,6 +19,7 @@ export namespace Rml { using Rml::CompiledGeometryHandle; using Rml::Vector2f; using Rml::Vector2i; + using Rml::Matrix4f; using Rml::ColourbPremultiplied; using Rml::String; using Rml::Rectanglei;