38 lines
826 B
C++
38 lines
826 B
C++
#pragma once
|
|
#include <jni.h>
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
class CppPlugin {
|
|
public:
|
|
void* handle;
|
|
virtual void onLoad() = 0;
|
|
virtual void onEnable() = 0;
|
|
virtual void onDisable() = 0;
|
|
//virtual ~CppPlugin();
|
|
};
|
|
|
|
class Event {
|
|
private:
|
|
std::string name; //name of the event
|
|
jobject input; //original Event object (type CppEvent)
|
|
std::map<std::string, void*> data;
|
|
public:
|
|
jobject getMap(JNIEnv* env);
|
|
const std::string& getName();
|
|
void* getData(JNIEnv* env, const std::string& name);
|
|
void setData(const std::string& name, void* data);
|
|
|
|
void reapply(JNIEnv* env, jobject jevent);
|
|
|
|
Event(JNIEnv* env, jobject jevent);
|
|
//virtual ~Event();
|
|
};
|
|
|
|
//function pointer
|
|
typedef void (*eventfptr)(CppPlugin*, Event*);
|
|
typedef std::map<std::string, eventfptr> (*getEventsfptr)();
|
|
typedef CppPlugin* (*initfptr)();
|
|
|