save state
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <android/hardware_buffer.h>
|
||||
#include <android/asset_manager.h>
|
||||
#include <RmlUi/Core.h>
|
||||
#include <RmlUi/Lua.h>
|
||||
#include "RmlUi_Renderer_GL3.h"
|
||||
#include <span>
|
||||
#include <ranges>
|
||||
@@ -119,6 +120,8 @@ void Kernel::main_loop()
|
||||
Rml::SetFileInterface(&AssetFilesInterface::Instance());
|
||||
Rml::SetSystemInterface(&SystemInterface::Instance());
|
||||
Rml::Initialise();
|
||||
Rml::Lua::Initialise();
|
||||
Logger::Log("RmlUi Lua bindings initialized");
|
||||
Rml::Context* context = Rml::CreateContext("default", Rml::Vector2i(540, 960));
|
||||
if (!context)
|
||||
{
|
||||
@@ -195,6 +198,11 @@ void Kernel::add_listener(const std::shared_ptr<IMosisListener> &listener)
|
||||
void Kernel::on_touch_down(float x, float y)
|
||||
{
|
||||
Logger::Log(std::format("on_touch_down {} - {}", x, y));
|
||||
std::lock_guard _lock(m_mutex);
|
||||
m_tasks.emplace_back([x, y](Rml::Context* context){
|
||||
context->ProcessMouseMove(static_cast<int>(x * 540), static_cast<int>(y * 960), 0);
|
||||
context->ProcessMouseButtonDown(0, 0);
|
||||
});
|
||||
}
|
||||
|
||||
void Kernel::on_touch_move(float x, float y)
|
||||
@@ -202,13 +210,18 @@ void Kernel::on_touch_move(float x, float y)
|
||||
Logger::Log(std::format("on_touch_move {} - {}", x, y));
|
||||
std::lock_guard _lock(m_mutex);
|
||||
m_tasks.emplace_back([x, y](Rml::Context* context){
|
||||
context->ProcessMouseMove(x * 540, y * 960, 0);
|
||||
context->ProcessMouseMove(static_cast<int>(x * 540), static_cast<int>(y * 960), 0);
|
||||
});
|
||||
}
|
||||
|
||||
void Kernel::on_touch_up(float x, float y)
|
||||
{
|
||||
Logger::Log(std::format("on_touch_up {} - {}", x, y));
|
||||
std::lock_guard _lock(m_mutex);
|
||||
m_tasks.emplace_back([x, y](Rml::Context* context){
|
||||
context->ProcessMouseMove(static_cast<int>(x * 540), static_cast<int>(y * 960), 0);
|
||||
context->ProcessMouseButtonUp(0, 0);
|
||||
});
|
||||
}
|
||||
|
||||
Kernel::~Kernel() = default;
|
||||
|
||||
Reference in New Issue
Block a user