Cleanups.

This commit is contained in:
Relintai 2023-12-31 13:58:00 +01:00
parent 5e8e7926f3
commit b0dfb4ef5e
2 changed files with 5 additions and 20 deletions

View File

@ -5,8 +5,7 @@
#include "shortcut.h" #include "shortcut.h"
#include "core/input/input_event.h" #include "core/render_core/input_event.h"
#include "core/os/keyboard.h"
void ShortCut::set_shortcut(const Ref<InputEvent> &p_shortcut) { void ShortCut::set_shortcut(const Ref<InputEvent> &p_shortcut) {
shortcut = p_shortcut; shortcut = p_shortcut;
@ -33,18 +32,6 @@ bool ShortCut::is_valid() const {
return shortcut.is_valid(); return shortcut.is_valid();
} }
void ShortCut::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shortcut", "event"), &ShortCut::set_shortcut);
ClassDB::bind_method(D_METHOD("get_shortcut"), &ShortCut::get_shortcut);
ClassDB::bind_method(D_METHOD("is_valid"), &ShortCut::is_valid);
ClassDB::bind_method(D_METHOD("is_shortcut", "event"), &ShortCut::is_shortcut);
ClassDB::bind_method(D_METHOD("get_as_text"), &ShortCut::get_as_text);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), "set_shortcut", "get_shortcut");
}
ShortCut::ShortCut() { ShortCut::ShortCut() {
} }

View File

@ -6,18 +6,13 @@
/* From https://github.com/Relintai/pandemonium_engine (MIT) */ /* From https://github.com/Relintai/pandemonium_engine (MIT) */
/*************************************************************************/ /*************************************************************************/
#include "core/object/resource.h" #include "resource.h"
class InputEvent; class InputEvent;
class ShortCut : public Resource { class ShortCut : public Resource {
GDCLASS(ShortCut, Resource); GDCLASS(ShortCut, Resource);
Ref<InputEvent> shortcut;
protected:
static void _bind_methods();
public: public:
void set_shortcut(const Ref<InputEvent> &p_shortcut); void set_shortcut(const Ref<InputEvent> &p_shortcut);
Ref<InputEvent> get_shortcut() const; Ref<InputEvent> get_shortcut() const;
@ -28,6 +23,9 @@ public:
ShortCut(); ShortCut();
~ShortCut(); ~ShortCut();
private:
Ref<InputEvent> shortcut;
}; };
#endif // SHORTCUT_H #endif // SHORTCUT_H