2023-05-23 02:06:58 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2024-06-02 14:10:35 +02:00
|
|
|
#include <cstdint>
|
2023-05-23 02:06:58 +02:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
struct SolanaAPI;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Plugin {
|
|
|
|
bool valid_plugin = false;
|
|
|
|
|
|
|
|
std::string name;
|
|
|
|
uint32_t version;
|
|
|
|
|
|
|
|
// void* is platform independent enough, maybe use uint64_t
|
|
|
|
void* _dl = nullptr;
|
|
|
|
void* _fn_name = nullptr; // TODO: make variable instead of function?
|
|
|
|
void* _fn_version = nullptr; // TODO: make variable instead of function?
|
|
|
|
void* _fn_start = nullptr;
|
|
|
|
void* _fn_stop = nullptr;
|
|
|
|
void* _fn_tick = nullptr;
|
2024-01-07 14:37:33 +01:00
|
|
|
void* _fn_render = nullptr;
|
2023-05-23 02:06:58 +02:00
|
|
|
|
|
|
|
void* loadSymbol(const char* name);
|
|
|
|
|
|
|
|
// loads lib and gets name (and version)
|
|
|
|
Plugin(const char* path);
|
|
|
|
Plugin(Plugin&& other);
|
|
|
|
Plugin(const Plugin& other) = delete;
|
|
|
|
|
|
|
|
// unloads the plugin
|
|
|
|
~Plugin(void);
|
|
|
|
|
|
|
|
|
|
|
|
// runs the start function
|
|
|
|
uint32_t start(SolanaAPI* solana_api) const;
|
|
|
|
|
|
|
|
// stop function
|
|
|
|
void stop(void) const;
|
|
|
|
|
2024-01-07 14:37:33 +01:00
|
|
|
// update functions
|
|
|
|
float tick(float delta) const;
|
|
|
|
float render(float delta) const;
|
2023-05-23 02:06:58 +02:00
|
|
|
|
|
|
|
operator bool(void) const {
|
|
|
|
return valid_plugin;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|