You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fixed mistakes in InputEvent as_text and to_string implementations.
This commit is contained in:
@@ -213,7 +213,7 @@ String InputEventWithModifiers::as_text() const {
|
|||||||
if (!mod_names.empty()) {
|
if (!mod_names.empty()) {
|
||||||
return String("+").join(mod_names);
|
return String("+").join(mod_names);
|
||||||
} else {
|
} else {
|
||||||
return "None";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,11 +369,19 @@ String InputEventKey::to_string() {
|
|||||||
String p = is_pressed() ? "true" : "false";
|
String p = is_pressed() ? "true" : "false";
|
||||||
String e = is_echo() ? "true" : "false";
|
String e = is_echo() ? "true" : "false";
|
||||||
|
|
||||||
|
String kc = "";
|
||||||
|
String physical = "false";
|
||||||
if (keycode == 0) {
|
if (keycode == 0) {
|
||||||
return vformat("InputEventKey: keycode=%s mods=%s physical=%s pressed=%s echo=%s", itos(physical_keycode) + " " + keycode_get_string(physical_keycode), InputEventWithModifiers::as_text(), "true", p, e);
|
kc = itos(physical_keycode) + " " + keycode_get_string(physical_keycode);
|
||||||
|
physical = "true";
|
||||||
} else {
|
} else {
|
||||||
return vformat("InputEventKey: keycode=%s mods=%s physical=%s pressed=%s echo=%s", itos(keycode) + " " + keycode_get_string(keycode), InputEventWithModifiers::as_text(), "false", p, e);
|
kc = itos(keycode) + " " + keycode_get_string(keycode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String mods = InputEventWithModifiers::as_text();
|
||||||
|
mods = mods == "" ? TTR("None") : mods;
|
||||||
|
|
||||||
|
return vformat("InputEventKey: keycode=%s mods=%s physical=%s pressed=%s echo=%s", kc, mods, physical, p, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float *p_raw_strength, float p_deadzone) const {
|
bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float *p_raw_strength, float p_deadzone) const {
|
||||||
@@ -633,7 +641,12 @@ String InputEventMouseButton::to_string() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return vformat("InputEventMouseButton: button_index=%s pressed=%s position=(%s) button_mask=%s doubleclick=%s", button_index, p, String(get_position()), itos(get_button_mask()), d);
|
String mods = InputEventWithModifiers::as_text();
|
||||||
|
mods = mods == "" ? TTR("None") : mods;
|
||||||
|
|
||||||
|
// Work around the fact vformat can only take 5 substitutions but 6 need to be passed.
|
||||||
|
String index_and_mods = vformat("button_index=%s mods=%s", button_index, mods);
|
||||||
|
return vformat("InputEventMouseButton: %s pressed=%s position=(%s) button_mask=%s doubleclick=%s", index_and_mods, p, String(get_position()), itos(get_button_mask()), d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputEventMouseButton::_bind_methods() {
|
void InputEventMouseButton::_bind_methods() {
|
||||||
|
|||||||
Reference in New Issue
Block a user