save state
This commit is contained in:
@@ -8,7 +8,23 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(BINDER_DIR "${ANDROID_SDK}/platforms/android-36/optional/libbinder_ndk_cpp")
|
||||
set(AIDL_EXE "${ANDROID_SDK}/build-tools/36.1.0/aidl.exe")
|
||||
|
||||
find_package(RmlUi CONFIG REQUIRED)
|
||||
# Find Lua from vcpkg
|
||||
find_package(Lua REQUIRED)
|
||||
|
||||
# Fetch RmlUi from GitHub with Lua bindings enabled
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
rmlui
|
||||
GIT_REPOSITORY https://github.com/mikke89/RmlUi.git
|
||||
GIT_TAG master
|
||||
)
|
||||
set(RMLUI_LUA_BINDINGS ON CACHE BOOL "" FORCE)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
set(RMLUI_SAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(RMLUI_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(RMLUI_FONT_ENGINE "freetype" CACHE STRING "" FORCE)
|
||||
set(RMLUI_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(rmlui)
|
||||
|
||||
#get_cmake_property(_variableNames VARIABLES)
|
||||
#list(SORT _variableNames)
|
||||
@@ -60,7 +76,7 @@ target_include_directories(mosis-service PUBLIC
|
||||
)
|
||||
target_link_libraries(mosis-service
|
||||
android log binder_ndk EGL GLESv2 nativewindow
|
||||
RmlUi::RmlUi
|
||||
rmlui rmlui_lua
|
||||
)
|
||||
|
||||
add_library(mosis-test SHARED
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"name": "mosis-os",
|
||||
"version-string": "0.1.0",
|
||||
"dependencies": [
|
||||
"rmlui"
|
||||
"lua",
|
||||
"freetype"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user