From 72e20ab43862f2a7a91cbb7b374bbe152d77e7d6 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 30 Apr 2023 10:27:36 -0400 Subject: Add GC stats display to overlay. --- catbird/overlay.scm | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 2 deletions(-) diff --git a/catbird/overlay.scm b/catbird/overlay.scm index 420b146..8d1306c 100644 --- a/catbird/overlay.scm +++ b/catbird/overlay.scm @@ -27,6 +27,7 @@ #:use-module (catbird region) #:use-module (catbird repl) #:use-module (catbird scene) + #:use-module (catbird ui) #:use-module (chickadee graphics color) #:use-module (chickadee graphics path) #:use-module (chickadee graphics text) @@ -101,6 +102,13 @@ "- Resume game." (unfreeze-all-regions)) + +;;; +;;; FPS Display +;;; + +(define %metrics-bg-color (make-color 1.0 0 0 0.8)) + (define-class ()) (define-method (on-boot (fps-display )) @@ -113,7 +121,7 @@ (make #:name 'background #:painter - (with-style ((fill-color (make-color 0 0 0 0.5))) + (with-style ((fill-color %metrics-bg-color)) (fill (rectangle (vec2 0.0 0.0) box-width @@ -157,4 +165,140 @@ (define-minibuffer-command repl (let ((s (scene-for-region 'overlay))) (when s - (push-major-mode s (make ))))) + (open-repl s)))) + + +;;; +;;; GC Display +;;; + +(define-class ()) + +(define-method (initialize (gc-display ) initargs) + (next-method) + (let* ((font (default-font)) + (padding 4.0)) + (attach-to gc-display + (make + #:name 'background + #:painter + (with-style ((fill-color %metrics-bg-color)) + (fill + (rectangle (vec2 0.0 0.0) 10.0 10.0)))) + (make + #:name 'table + #:margin padding + #:children + (list (make + #:name 'columns + #:children + (list (make + #:name 'names + #:children + (list (make