diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/gui/overlays/debug/debug_pie.gd | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/client/gui/overlays/debug/debug_pie.gd b/client/gui/overlays/debug/debug_pie.gd index c1140683..02201776 100644 --- a/client/gui/overlays/debug/debug_pie.gd +++ b/client/gui/overlays/debug/debug_pie.gd @@ -1,3 +1,18 @@ +# Hurry Curry! - a game about cooking +# Copyright (C) 2025 Hurry Curry! contributors +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# extends Control @export var radius: float = 150 @@ -44,6 +59,8 @@ func setup_counters(): class_lookup.clear() data.clear() for c in ClassDB.get_inheriters_from_class(current_class): + class_lookup[current_class] = current_class + data[current_class] = 0 if ClassDB.get_parent_class(c) == current_class: class_lookup[c] = c data[c] = 0 @@ -79,27 +96,28 @@ func get_draw_size(): func _draw(): draw_rect(Rect2(Vector2.ZERO, get_draw_size()), Color(.1,.1,.1,0.8)) offset = 0. - draw_row(0, current_class, total) + draw_row(0, current_class, total, current_class == "Node") draw_pie() for i in range(sorted.size()): var label = sorted[i][0]; var value = sorted[i][1] - draw_row(i + 1, label, value) + draw_row(i + 1, label, value, label == current_class) func draw_pie(): - draw_set_transform(Vector2(radius, offset + radius * pie_squish)) + draw_set_transform(Vector2(radius, offset + radius * pie_squish + 10)) var angle = 0. for i in range(sorted.size()): var label = sorted[i][0]; var value = sorted[i][1] var inc = float(value) / float(total) * PI * 2. draw_slice(angle, angle + inc, label_color(i+1, label)) angle += inc - offset += radius * 2 * pie_squish + offset += radius * 2 * pie_squish + 20 draw_set_transform(Vector2.ZERO) -func draw_row(index: int, label: String, value: int): +func draw_row(index: int, label: String, value: int, nokb: bool): offset += font_size var color = label_color(index, label) var text_left = "[%d] %s" % [index, label] + if nokb: text_left = "[_] %s" % label var text_right = "%3d" % value draw_string(font, Vector2(0., offset), text_left, HORIZONTAL_ALIGNMENT_LEFT, radius * 1.5, font_size, color) draw_string(font, Vector2(radius * 1.5, offset), text_right, HORIZONTAL_ALIGNMENT_LEFT, radius * 0.5, font_size, color) |