Rewrite existing credits

Each credit has its own draw function

Credits outside of the visible game area are not drawn
This commit is contained in:
Amy Grinn 2025-01-08 12:26:08 -05:00
parent 7d4d6115a4
commit afef0fd480
No known key found for this signature in database
GPG key ID: 6B558BED1DCF3192
5 changed files with 174 additions and 76 deletions

View file

@ -39,7 +39,8 @@
translate!
rotate!
set-transform!
set-image-smoothing-enabled!))
set-image-smoothing-enabled!
measure-text))
;; HTMLCanvasElement
(define-foreign get-context
@ -98,3 +99,6 @@
(define-foreign set-image-smoothing-enabled!
"canvas" "setImageSmoothingEnabled"
(ref extern) i32 -> none)
(define-foreign measure-text
"canvas" "measureText"
(ref extern) (ref string) -> (ref extern))

View file

@ -0,0 +1,34 @@
;;; Copyright (C) 2025 Amy Grinn <amy@spritely.institute>
;;;
;;; Licensed under the Apache License, Version 2.0 (the "License");
;;; you may not use this file except in compliance with the License.
;;; You may obtain a copy of the License at
;;;
;;; http://www.apache.org/licenses/LICENSE-2.0
;;;
;;; Unless required by applicable law or agreed to in writing, software
;;; distributed under the License is distributed on an "AS IS" BASIS,
;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;;; See the License for the specific language governing permissions and
;;; limitations under the License.
;;; Commentary:
;;;
;;; HTML canvas TextMetrics interface bindings
;;;
;;; Code:
(define-module (dom text-metrics)
#:pure
#:use-module (scheme base)
#:use-module (hoot ffi)
#:export (text-metrics-actual-bounding-box-ascent
text-metrics-actual-bounding-box-descent))
(define-foreign text-metrics-actual-bounding-box-ascent
"textMetrics" "actualBoundingBoxAscent"
(ref extern) -> i32)
(define-foreign text-metrics-actual-bounding-box-descent
"textMetrics" "actualBoundingBoxDescent"
(ref extern) -> i32)

3
modules/srfi/srf-1.scm Normal file
View file

@ -0,0 +1,3 @@
(define-module (srfi srfi-1)
#:use-module ((scheme base) #:select (fold))
#:re-export (fold))