You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Improve to_string() and add it to Resource
This commit is contained in:
@@ -277,7 +277,7 @@ String InputEventWithModifiers::as_text() const {
|
||||
}
|
||||
}
|
||||
|
||||
String InputEventWithModifiers::to_string() {
|
||||
String InputEventWithModifiers::_to_string() {
|
||||
return as_text();
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ String InputEventKey::as_text() const {
|
||||
return mods_text.is_empty() ? kc : mods_text + "+" + kc;
|
||||
}
|
||||
|
||||
String InputEventKey::to_string() {
|
||||
String InputEventKey::_to_string() {
|
||||
String p = is_pressed() ? "true" : "false";
|
||||
String e = is_echo() ? "true" : "false";
|
||||
|
||||
@@ -848,7 +848,7 @@ String InputEventMouseButton::as_text() const {
|
||||
return full_string;
|
||||
}
|
||||
|
||||
String InputEventMouseButton::to_string() {
|
||||
String InputEventMouseButton::_to_string() {
|
||||
String p = is_pressed() ? "true" : "false";
|
||||
String canceled_state = is_canceled() ? "true" : "false";
|
||||
String d = double_click ? "true" : "false";
|
||||
@@ -988,7 +988,7 @@ String InputEventMouseMotion::as_text() const {
|
||||
return vformat(RTR("Mouse motion at position (%s) with velocity (%s)"), String(get_position()), String(get_velocity()));
|
||||
}
|
||||
|
||||
String InputEventMouseMotion::to_string() {
|
||||
String InputEventMouseMotion::_to_string() {
|
||||
BitField<MouseButtonMask> mouse_button_mask = get_button_mask();
|
||||
String button_mask_string = itos((int64_t)mouse_button_mask);
|
||||
|
||||
@@ -1184,7 +1184,7 @@ String InputEventJoypadMotion::as_text() const {
|
||||
return vformat(RTR("Joypad Motion on Axis %d (%s) with Value %.2f"), axis, desc, axis_value);
|
||||
}
|
||||
|
||||
String InputEventJoypadMotion::to_string() {
|
||||
String InputEventJoypadMotion::_to_string() {
|
||||
return vformat("InputEventJoypadMotion: axis=%d, axis_value=%.2f", axis, axis_value);
|
||||
}
|
||||
|
||||
@@ -1303,7 +1303,7 @@ String InputEventJoypadButton::as_text() const {
|
||||
return text;
|
||||
}
|
||||
|
||||
String InputEventJoypadButton::to_string() {
|
||||
String InputEventJoypadButton::_to_string() {
|
||||
String p = is_pressed() ? "true" : "false";
|
||||
return vformat("InputEventJoypadButton: button_index=%d, pressed=%s, pressure=%.2f", button_index, p, pressure);
|
||||
}
|
||||
@@ -1386,7 +1386,7 @@ String InputEventScreenTouch::as_text() const {
|
||||
return vformat(RTR("Screen %s at (%s) with %s touch points"), status, String(get_position()), itos(index));
|
||||
}
|
||||
|
||||
String InputEventScreenTouch::to_string() {
|
||||
String InputEventScreenTouch::_to_string() {
|
||||
String p = pressed ? "true" : "false";
|
||||
String canceled_state = canceled ? "true" : "false";
|
||||
String double_tap_string = double_tap ? "true" : "false";
|
||||
@@ -1514,7 +1514,7 @@ String InputEventScreenDrag::as_text() const {
|
||||
return vformat(RTR("Screen dragged with %s touch points at position (%s) with velocity of (%s)"), itos(index), String(get_position()), String(get_velocity()));
|
||||
}
|
||||
|
||||
String InputEventScreenDrag::to_string() {
|
||||
String InputEventScreenDrag::_to_string() {
|
||||
return vformat("InputEventScreenDrag: index=%d, position=(%s), relative=(%s), velocity=(%s), pressure=%.2f, tilt=(%s), pen_inverted=(%s)", index, String(get_position()), String(get_relative()), String(get_velocity()), get_pressure(), String(get_tilt()), get_pen_inverted());
|
||||
}
|
||||
|
||||
@@ -1656,7 +1656,7 @@ String InputEventAction::as_text() const {
|
||||
return String();
|
||||
}
|
||||
|
||||
String InputEventAction::to_string() {
|
||||
String InputEventAction::_to_string() {
|
||||
String p = is_pressed() ? "true" : "false";
|
||||
return vformat("InputEventAction: action=\"%s\", pressed=%s", action, p);
|
||||
}
|
||||
@@ -1727,7 +1727,7 @@ String InputEventMagnifyGesture::as_text() const {
|
||||
return vformat(RTR("Magnify Gesture at (%s) with factor %s"), String(get_position()), rtos(get_factor()));
|
||||
}
|
||||
|
||||
String InputEventMagnifyGesture::to_string() {
|
||||
String InputEventMagnifyGesture::_to_string() {
|
||||
return vformat("InputEventMagnifyGesture: factor=%.2f, position=(%s)", factor, String(get_position()));
|
||||
}
|
||||
|
||||
@@ -1769,7 +1769,7 @@ String InputEventPanGesture::as_text() const {
|
||||
return vformat(RTR("Pan Gesture at (%s) with delta (%s)"), String(get_position()), String(get_delta()));
|
||||
}
|
||||
|
||||
String InputEventPanGesture::to_string() {
|
||||
String InputEventPanGesture::_to_string() {
|
||||
return vformat("InputEventPanGesture: delta=(%s), position=(%s)", String(get_delta()), String(get_position()));
|
||||
}
|
||||
|
||||
@@ -1850,7 +1850,7 @@ String InputEventMIDI::as_text() const {
|
||||
return vformat(RTR("MIDI Input on Channel=%s Message=%s"), itos(channel), itos((int64_t)message));
|
||||
}
|
||||
|
||||
String InputEventMIDI::to_string() {
|
||||
String InputEventMIDI::_to_string() {
|
||||
String ret;
|
||||
switch (message) {
|
||||
case MIDIMessage::NOTE_ON:
|
||||
@@ -1926,7 +1926,7 @@ String InputEventShortcut::as_text() const {
|
||||
return vformat(RTR("Input Event with Shortcut=%s"), shortcut->get_as_text());
|
||||
}
|
||||
|
||||
String InputEventShortcut::to_string() {
|
||||
String InputEventShortcut::_to_string() {
|
||||
ERR_FAIL_COND_V(shortcut.is_null(), "None");
|
||||
|
||||
return vformat("InputEventShortcut: shortcut=%s", shortcut->get_as_text());
|
||||
|
||||
Reference in New Issue
Block a user