From 58fe69fd5df3dbe716609af654129831365b68ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BENEDEK=20L=C3=A1szl=C3=B3?= Date: Fri, 31 May 2024 21:45:42 +0200 Subject: [PATCH] star plugin --- src/graph/plugins/CMakeLists.txt | 10 +++++++++- src/graph/plugins/star/CMakeLists.txt | 3 +++ src/graph/plugins/star/star.c | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/graph/plugins/star/CMakeLists.txt create mode 100644 src/graph/plugins/star/star.c diff --git a/src/graph/plugins/CMakeLists.txt b/src/graph/plugins/CMakeLists.txt index a27923c..62ae908 100644 --- a/src/graph/plugins/CMakeLists.txt +++ b/src/graph/plugins/CMakeLists.txt @@ -1 +1,9 @@ -add_subdirectory("./http") \ No newline at end of file +option(ENABLE_PLUGIN_HTTP "Enable http plugin" ON) +if(ENABLE_PLUGIN_HTTP) + add_subdirectory("./http") +endif() + +option(ENABLE_PLUGIN_STAR "Enable star plugin" ON) +if(ENABLE_PLUGIN_STAR) + add_subdirectory("./star") +endif() \ No newline at end of file diff --git a/src/graph/plugins/star/CMakeLists.txt b/src/graph/plugins/star/CMakeLists.txt new file mode 100644 index 0000000..68e52b4 --- /dev/null +++ b/src/graph/plugins/star/CMakeLists.txt @@ -0,0 +1,3 @@ +file(GLOB_RECURSE STAR_SOURCES "./*.c") +add_library(star SHARED ${STAR_SOURCES}) +set_target_properties(star PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") \ No newline at end of file diff --git a/src/graph/plugins/star/star.c b/src/graph/plugins/star/star.c new file mode 100644 index 0000000..0acd089 --- /dev/null +++ b/src/graph/plugins/star/star.c @@ -0,0 +1,23 @@ +#include + +int run(); +int destroy(); + +plugin_t plugin = {.version=1, .run_method=&run, .destroy_method=&destroy, .update_callback=0, .argc=0, .argv=0}; + +int run() { + point_t points[6] = { + {2/4.0, 2/2.0}, + {3/4.0, 0/2.0}, + {0/4.0, 1/2.0}, + {4/4.0, 1/2.0}, + {1/4.0, 0/2.0}, + {2/4.0, 2/2.0} + }; + + plugin.update_callback(0, "star", points, 6); + + return 0; +} + +int destroy() { return 0; } \ No newline at end of file