mirror of
https://github.com/Mestima/GodotHook.git
synced 2025-05-03 14:50:27 +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"
|
||||
|
||||
Dictionary Hook::getTable() {
|
||||
Dictionary Hook::GetTable() {
|
||||
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());
|
||||
tmp[uid] = function;
|
||||
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;
|
||||
if (args.size() > 0) {
|
||||
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());
|
||||
if (!tmp.is_empty()) {
|
||||
if (tmp.erase(uid)) {
|
||||
@ -54,10 +54,10 @@ void Hook::remove(String event, String uid) {
|
||||
}
|
||||
|
||||
void Hook::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("getTable"), &Hook::getTable);
|
||||
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("remove", "event", "uid"), &Hook::remove);
|
||||
ClassDB::bind_method(D_METHOD("GetTable"), &Hook::GetTable);
|
||||
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("Remove", "event", "uid"), &Hook::Remove);
|
||||
};
|
||||
|
||||
Hook::Hook() {
|
||||
|
8
hook.h
8
hook.h
@ -19,10 +19,10 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
Dictionary getTable();
|
||||
void add(String event, String uid, Callable function);
|
||||
void call(String event, Array args, bool defer);
|
||||
void remove(String event, String uid);
|
||||
Dictionary GetTable();
|
||||
void Add(String event, String uid, Callable function);
|
||||
void Call(String event, Array args, bool defer);
|
||||
void Remove(String event, String uid);
|
||||
Hook();
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user