star plugin

This commit is contained in:
BENEDEK László 2024-05-31 21:45:42 +02:00
parent 839537af37
commit 58fe69fd5d
3 changed files with 35 additions and 1 deletions

View File

@ -1 +1,9 @@
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()

View File

@ -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")

View File

@ -0,0 +1,23 @@
#include <graph/plugins/plugin.h>
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; }