mirror of
https://github.com/Mestima/GodotHook.git
synced 2025-05-03 23:00:23 +00:00
Revert "Hook class methods are now following to lowercase naming convention"
This reverts commit ed1903119acc68287964440f7d075d66faee1ff2.
This commit is contained in:
parent
adb93c170d
commit
bab2506cc7
16
hook.cpp
16
hook.cpp
@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
#include "hook.h"
|
#include "hook.h"
|
||||||
|
|
||||||
Dictionary Hook::getTable() {
|
Dictionary Hook::GetTable() {
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hook::add(String event, String uid, Callable function) {
|
void Hook::Add(String event, String uid, Callable function) {
|
||||||
Dictionary tmp = table.get(event, Dictionary());
|
Dictionary tmp = table.get(event, Dictionary());
|
||||||
tmp[uid] = function;
|
tmp[uid] = function;
|
||||||
table[event] = tmp;
|
table[event] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hook::call(String event, Array args = Array(), bool defer = false) {
|
void Hook::Call(String event, Array args = Array(), bool defer = false) {
|
||||||
const Variant **argptrs = nullptr;
|
const Variant **argptrs = nullptr;
|
||||||
if (args.size() > 0) {
|
if (args.size() > 0) {
|
||||||
argptrs = (const Variant **)alloca(sizeof(Variant *) * args.size());
|
argptrs = (const Variant **)alloca(sizeof(Variant *) * args.size());
|
||||||
@ -40,7 +40,7 @@ void Hook::call(String event, Array args = Array(), bool defer = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hook::remove(String event, String uid) {
|
void Hook::Remove(String event, String uid) {
|
||||||
Dictionary tmp = table.get(event, Dictionary());
|
Dictionary tmp = table.get(event, Dictionary());
|
||||||
if (!tmp.is_empty()) {
|
if (!tmp.is_empty()) {
|
||||||
if (tmp.erase(uid)) {
|
if (tmp.erase(uid)) {
|
||||||
@ -54,10 +54,10 @@ void Hook::remove(String event, String uid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Hook::_bind_methods() {
|
void Hook::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("getTable"), &Hook::getTable);
|
ClassDB::bind_method(D_METHOD("GetTable"), &Hook::GetTable);
|
||||||
ClassDB::bind_method(D_METHOD("add", "event", "uid", "function"), &Hook::add);
|
ClassDB::bind_method(D_METHOD("Add", "event", "uid", "function"), &Hook::Add);
|
||||||
ClassDB::bind_method(D_METHOD("call", "event", "args", "defer"), &Hook::call, DEFVAL(Array()), DEFVAL(false));
|
ClassDB::bind_method(D_METHOD("Call", "event", "args", "defer"), &Hook::Call, DEFVAL(Array()), DEFVAL(false));
|
||||||
ClassDB::bind_method(D_METHOD("remove", "event", "uid"), &Hook::remove);
|
ClassDB::bind_method(D_METHOD("Remove", "event", "uid"), &Hook::Remove);
|
||||||
};
|
};
|
||||||
|
|
||||||
Hook::Hook() {
|
Hook::Hook() {
|
||||||
|
8
hook.h
8
hook.h
@ -19,10 +19,10 @@ protected:
|
|||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Dictionary getTable();
|
Dictionary GetTable();
|
||||||
void add(String event, String uid, Callable function);
|
void Add(String event, String uid, Callable function);
|
||||||
void call(String event, Array args, bool defer);
|
void Call(String event, Array args, bool defer);
|
||||||
void remove(String event, String uid);
|
void Remove(String event, String uid);
|
||||||
Hook();
|
Hook();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user