Add LunaSVG

This commit is contained in:
Isuru Samarathunga
2025-10-18 09:26:01 +05:30
parent 4597d0a4aa
commit 57bc80f4f9
187 changed files with 12435 additions and 24 deletions

View File

@ -89,12 +89,9 @@ namespace ia::iae
.primitive_type = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST,
.rasterizer_state = SDL_GPURasterizerState{.fill_mode = SDL_GPU_FILLMODE_FILL,
.cull_mode = SDL_GPU_CULLMODE_NONE,
.front_face = SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE},
.depth_stencil_state = SDL_GPUDepthStencilState{.compare_op = SDL_GPU_COMPAREOP_GREATER_OR_EQUAL,
.write_mask = 0xFF,
.enable_depth_test = false,
.enable_depth_write = false,
.enable_stencil_test = false},
.front_face = SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE,
.enable_depth_clip = true
},
.target_info = {.color_target_descriptions = &colorTargetDesc,
.num_color_targets = 1,
.has_depth_stencil_target = false},

View File

@ -419,8 +419,16 @@ namespace ia::iae
g_context->Render();
}
static Rml::TouchList TouchEventToTouchList(SDL_Event &ev, Rml::Context *context, SDL_FingerID finger_id)
{
const Rml::Vector2f position =
Rml::Vector2f{ev.tfinger.x, ev.tfinger.y} * Rml::Vector2f{context->GetDimensions()};
return {Rml::Touch{static_cast<Rml::TouchId>(finger_id), position}};
}
VOID UI::OnSDLEvent(IN PVOID _event)
{
auto GetFingerId = [](const SDL_Event &event) { return event.tfinger.fingerID; };
const auto keymods = GetKeyModifierState();
const auto event = (SDL_Event *) _event;
switch (event->type)
@ -443,12 +451,26 @@ namespace ia::iae
case SDL_EventType::SDL_EVENT_TEXT_INPUT:
g_context->ProcessTextInput(Rml::String(&event->text.text[0]));
break;
case SDL_EventType::SDL_EVENT_FINGER_DOWN: {
const Rml::TouchList touches = TouchEventToTouchList(*event, g_context, GetFingerId(*event));
g_context->ProcessTouchStart(touches, GetKeyModifierState());
}
break;
case SDL_EventType::SDL_EVENT_FINGER_MOTION: {
const Rml::TouchList touches = TouchEventToTouchList(*event, g_context, GetFingerId(*event));
g_context->ProcessTouchMove(touches, GetKeyModifierState());
}
break;
case SDL_EventType::SDL_EVENT_FINGER_UP: {
const Rml::TouchList touches = TouchEventToTouchList(*event, g_context, GetFingerId(*event));
g_context->ProcessTouchEnd(touches, GetKeyModifierState());
}
}
}
VOID UI::OnScreenResize(IN INT32 newWidth, IN INT32 newHeight)
{
//g_context->SetDimensions(Rml::Vector2i{newWidth, newHeight});
g_context->SetDimensions(Rml::Vector2i{newWidth, newHeight});
}
VOID UI::AddFontFromFile(IN CONST String &path)
@ -460,8 +482,8 @@ namespace ia::iae
{
g_styleSheetContainer = Rml::Factory::InstanceStyleSheetString(styles.c_str());
g_markup = BuildString("<body style=\"display: block; width: 100vw; height: 100vh;\">", markup, "</body>");
//g_document->SetStyleSheetContainer(g_styleSheetContainer);
//g_document->SetInnerRML(g_markup.c_str());
g_document->SetStyleSheetContainer(g_styleSheetContainer);
g_document->SetInnerRML(g_markup.c_str());
}
VOID UI::AddClickEvent(IN PCCHAR elementId, IN std::function<VOID()> callback)

View File

@ -507,7 +507,7 @@ static void ImGui_ImplSDLGPU3_CreateGraphicsPipeline()
rasterizer_state.cull_mode = SDL_GPU_CULLMODE_NONE;
rasterizer_state.front_face = SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE;
rasterizer_state.enable_depth_bias = false;
rasterizer_state.enable_depth_clip = false;
rasterizer_state.enable_depth_clip = true;
SDL_GPUMultisampleState multisample_state = {};
multisample_state.sample_count = v->MSAASamples;

View File

@ -60,6 +60,7 @@ namespace ia::iae
VOID AddChild(IN RefPtr<Node2D> node)
{
node->m_parent = this;
m_children.pushBack(node);
}
@ -180,7 +181,7 @@ namespace ia::iae
}
protected:
RefPtr<Node2D> m_parent{};
Node2D* m_parent{};
Vector<IComponent *> m_components;
Vector<RefPtr<Node2D>> m_children{};