diff --git a/packages/embedder_texture/aurora/CMakeLists.txt b/packages/embedder_texture/aurora/CMakeLists.txt new file mode 100644 index 0000000..418f1ce --- /dev/null +++ b/packages/embedder_texture/aurora/CMakeLists.txt @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.10) + +set(PROJECT_NAME embedder_texture) +set(PLUGIN_NAME embedder_texture_platform_plugin) + +project(${PROJECT_NAME} LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-psabi") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + +find_package(PkgConfig REQUIRED) +pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) + +add_library(${PLUGIN_NAME} SHARED embedder_texture_plugin.cpp) + +set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) +target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::FlutterEmbedder) + +target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_compile_definitions(${PLUGIN_NAME} PRIVATE PLUGIN_IMPL) diff --git a/packages/embedder_texture/aurora/embedder_texture_plugin.cpp b/packages/embedder_texture/aurora/embedder_texture_plugin.cpp new file mode 100644 index 0000000..ff9bdf8 --- /dev/null +++ b/packages/embedder_texture/aurora/embedder_texture_plugin.cpp @@ -0,0 +1,47 @@ +/** + * SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +#include +#include +#include +#include + +void EmbedderTexturePlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) +{ + registrar.RegisterMethodChannel("embedder_texture", + MethodCodecType::Standard, + [this](const MethodCall &call) { this->onMethodCall(call); }); +} + +void EmbedderTexturePlugin::onMethodCall(const MethodCall &call) +{ + const auto &method = call.GetMethod(); + + if (method == "create") { + onCreate(call); + return; + } + + if (method == "remove") { + onRemove(call); + return; + } + + unimplemented(call); +} + +void EmbedderTexturePlugin::onCreate(const MethodCall &call) +{ + call.SendSuccessResponse(0); +} + +void EmbedderTexturePlugin::onRemove(const MethodCall &call) +{ + call.SendSuccessResponse(nullptr); +} + +void EmbedderTexturePlugin::unimplemented(const MethodCall &call) +{ + call.SendSuccessResponse(nullptr); +} diff --git a/packages/embedder_texture/aurora/include/embedder_texture/embedder_texture_plugin.h b/packages/embedder_texture/aurora/include/embedder_texture/embedder_texture_plugin.h new file mode 100644 index 0000000..a561068 --- /dev/null +++ b/packages/embedder_texture/aurora/include/embedder_texture/embedder_texture_plugin.h @@ -0,0 +1,28 @@ +/** + * SPDX-FileCopyrightText: Copyright 2023 Open Mobile Platform LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +#ifndef EMBEDDER_TEXTURE_PLUGIN_H +#define EMBEDDER_TEXTURE_PLUGIN_H + +#include + +#ifdef PLUGIN_IMPL +#define PLUGIN_EXPORT __attribute__((visibility("default"))) +#else +#define PLUGIN_EXPORT +#endif + +class PLUGIN_EXPORT EmbedderTexturePlugin final : public PluginInterface +{ +public: + void RegisterWithRegistrar(PluginRegistrar ®istrar) override; + +private: + void onMethodCall(const MethodCall &call); + void onCreate(const MethodCall &call); + void onRemove(const MethodCall &call); + void unimplemented(const MethodCall &call); +}; + +#endif /* EMBEDDER_TEXTURE_PLUGIN_H */ diff --git a/packages/embedder_texture/lib/embedder_texture.dart b/packages/embedder_texture/lib/embedder_texture.dart index ebd067d..fc00a24 100644 --- a/packages/embedder_texture/lib/embedder_texture.dart +++ b/packages/embedder_texture/lib/embedder_texture.dart @@ -28,6 +28,7 @@ class _EmbedderTextureState extends State { .then((value) => setState(() { if (mounted) { _textureID = value!; + debugPrint(_textureID.toString()); } })); } diff --git a/packages/embedder_texture/pubspec.yaml b/packages/embedder_texture/pubspec.yaml index e398273..fc668a8 100644 --- a/packages/embedder_texture/pubspec.yaml +++ b/packages/embedder_texture/pubspec.yaml @@ -21,3 +21,5 @@ flutter: platforms: linux: pluginClass: EmbedderTexturePlugin + aurora: + pluginClass: EmbedderTexturePlugin