This commit is contained in:
2026-01-06 22:59:23 +01:00
commit 2d8cba9012
10 changed files with 234 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

23
CMakeLists.txt Normal file
View File

@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.22.1)
project("mosis-designer")
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(RmlUi CONFIG REQUIRED)
find_package(glfw3 CONFIG REQUIRED)
set(RMLUI_BACKEND "D:/vcpkg/buildtrees/rmlui/src/6.1-fbf6dfc3b5.clean/Backends")
add_executable(mosis-designer
main.cpp
${RMLUI_BACKEND}/RmlUi_Backend_GLFW_GL3.cpp
${RMLUI_BACKEND}/RmlUi_Platform_GLFW.cpp
${RMLUI_BACKEND}/RmlUi_Renderer_GL3.cpp
)
target_link_libraries(mosis-designer PUBLIC
RmlUi::RmlUi glfw
)
target_include_directories(mosis-designer PUBLIC
${RMLUI_BACKEND}
)

BIN
assets/LatoLatin-Bold.ttf Normal file

Binary file not shown.

Binary file not shown.

BIN
assets/LatoLatin-Italic.ttf Normal file

Binary file not shown.

Binary file not shown.

28
assets/demo.rml Normal file
View File

@@ -0,0 +1,28 @@
<rml>
<head>
<link type="text/rcss" href="phone.rcss"/>
<title>Fullscreen Mobile UI</title>
</head>
<body>
<div id="status-bar">
<span class="time">22:47</span>
<div class="status-icons">
<span class="icon">📶</span>
<span class="icon">🔋</span>
</div>
</div>
<div id="content">
<div class="header-section">
<h1>Activity</h1>
<p>Monday, January 5</p>
</div>
</div>
<div id="nav-bar">
<div class="nav-item">Home</div>
<div class="nav-item">Apps</div>
<div class="nav-item">Settings</div>
</div>
</body>
</rml>

101
assets/phone.rcss Normal file
View File

@@ -0,0 +1,101 @@
/* Ensure the body fills the entire window */
body {
font-family: LatoLatin;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background: #0f0f12;
color: white;
}
/* Status Bar pinned to top */
#status-bar {
display: block;
height: 40px;
padding: 10px 20px 0;
background-color: rgba(0, 0, 0, 0.2);
}
.time {
float: left;
font-weight: bold;
font-size: 1.1em;
}
.status-icons {
float: right;
}
.icon {
margin-left: 10px;
}
/* Content area grows to fill space */
#content {
padding: 20px;
/* Leaves room for status and nav bars */
height: 80%;
align: center;
}
.header-section {
margin-bottom: 30px;
text-align: center;
}
h1 {
font-size: 2.5em;
font-weight: bold;
}
/* Mobile-style cards */
.card {
background: #1e1e24;
border-radius: 20px;
padding: 20px;
margin-bottom: 15px;
border: 1px solid #333;
}
.card-title {
font-size: 1.2em;
margin-bottom: 10px;
color: #3498db;
}
.progress-bar {
height: 8px;
background: #333;
border-radius: 4px;
margin: 10px 0;
}
.progress-fill {
width: 84%;
height: 100%;
background: #3498db;
border-radius: 4px;
}
/* Navigation Bar pinned to bottom */
#nav-bar {
position: absolute;
bottom: 0;
width: 100%;
height: 65px;
background-color: #16161a;
display: flex;
justify-content: space-around;
align-items: center;
border-top: 1px solid #333;
}
.nav-item {
font-size: 1.9em;
color: #888;
}
.nav-item:hover {
color: #3498db;
}

73
main.cpp Normal file
View File

@@ -0,0 +1,73 @@
#include <print>
#include <thread>
#include <chrono>
#include <RmlUi/Core.h>
#include <RmlUi/Debugger.h>
#include <RmlUi_Backend.h>
#include <RmlUi_Include_Windows.h>
void LoadFonts()
{
const Rml::String directory = "assets/";
struct FontFace {
const char* filename;
bool fallback_face;
};
FontFace font_faces[] = {
{"LatoLatin-Regular.ttf", false},
{"LatoLatin-Italic.ttf", false},
{"LatoLatin-Bold.ttf", false},
{"LatoLatin-BoldItalic.ttf", false},
{"NotoEmoji-Regular.ttf", true},
};
for (const FontFace& face : font_faces)
Rml::LoadFontFace(directory + face.filename, face.fallback_face);
}
int main()
{
const int window_width = 1024;
const int window_height = 768;
if (!Backend::Initialize("Load Document Sample", window_width, window_height, true))
{
return -1;
}
Rml::SetSystemInterface(Backend::GetSystemInterface());
Rml::SetRenderInterface(Backend::GetRenderInterface());
Rml::Initialise();
Rml::Context* context = Rml::CreateContext("main", Rml::Vector2i(window_width, window_height));
if (!context)
{
Rml::Shutdown();
Backend::Shutdown();
return -1;
}
LoadFonts();
if (Rml::ElementDocument* document = context->LoadDocument("assets/demo.rml"))
{
document->Show();
}
bool running = true;
while (running)
{
// Handle input and window events.
running = Backend::ProcessEvents(context);
context->Update();
Backend::BeginFrame();
context->Render();
Backend::PresentFrame();
}
Rml::Shutdown();
Backend::Shutdown();
return EXIT_SUCCESS;
}

8
vcpkg.json Normal file
View File

@@ -0,0 +1,8 @@
{
"name": "mosis-designer",
"version-string": "0.1.0",
"dependencies": [
"rmlui",
"glfw3"
]
}