You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-24 15:26:15 +00:00
Add compatibility properties to TouchScreenButton
Added support for `3.x` properties: * `normal` -> `texture_normal` * `pressed` -> `texture_pressed`
This commit is contained in:
@@ -369,6 +369,19 @@ bool TouchScreenButton::is_passby_press_enabled() const {
|
|||||||
return passby_press;
|
return passby_press;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DISABLE_DEPRECATED
|
||||||
|
bool TouchScreenButton::_set(const StringName &p_name, const Variant &p_value) {
|
||||||
|
if (p_name == SNAME("normal")) { // Compatibility with Godot 3.x.
|
||||||
|
set_texture_normal(p_value);
|
||||||
|
return true;
|
||||||
|
} else if (p_name == SNAME("pressed")) { // Compatibility with Godot 3.x.
|
||||||
|
set_texture_pressed(p_value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif // DISABLE_DEPRECATED
|
||||||
|
|
||||||
void TouchScreenButton::_bind_methods() {
|
void TouchScreenButton::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_texture_normal", "texture"), &TouchScreenButton::set_texture_normal);
|
ClassDB::bind_method(D_METHOD("set_texture_normal", "texture"), &TouchScreenButton::set_texture_normal);
|
||||||
ClassDB::bind_method(D_METHOD("get_texture_normal"), &TouchScreenButton::get_texture_normal);
|
ClassDB::bind_method(D_METHOD("get_texture_normal"), &TouchScreenButton::get_texture_normal);
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
#ifndef DISABLE_DEPRECATED
|
||||||
|
bool _set(const StringName &p_name, const Variant &p_value);
|
||||||
|
#endif // DISABLE_DEPRECATED
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
|
|||||||
Reference in New Issue
Block a user