summaryrefslogtreecommitdiff
path: root/starling/kernel.scm
diff options
context:
space:
mode:
Diffstat (limited to 'starling/kernel.scm')
-rw-r--r--starling/kernel.scm44
1 files changed, 23 insertions, 21 deletions
diff --git a/starling/kernel.scm b/starling/kernel.scm
index db78932..e302df1 100644
--- a/starling/kernel.scm
+++ b/starling/kernel.scm
@@ -29,6 +29,7 @@
#:use-module (chickadee graphics color)
#:use-module (chickadee graphics font)
#:use-module (chickadee graphics gpu)
+ #:use-module (chickadee graphics path)
#:use-module (chickadee graphics viewport)
#:use-module (chickadee math rect)
#:use-module (chickadee math vector)
@@ -85,23 +86,24 @@
(box-width (+ (font-line-width font "60.0")
(* padding 2.0)))
(box-height (+ (font-line-height font) (* padding 2.0))))
- (match (current-window-size)
- ((_ window-height)
- (attach-to canvas
- (make <filled-rect>
- #:region (make-rect 0.0
- (- window-height box-height)
- box-width
- box-height)
- #:color (make-color 0.0 0.0 0.0 0.5))
- (make <label>
- #:name 'fps-label
- #:rank 9
- #:text "60.0"
- #:font font
- #:position (vec2 padding
- (+ (- window-height box-height)
- padding))))))
+ (call-with-values current-window-size
+ (lambda (window-width window-height)
+ (attach-to canvas
+ (make <path>
+ #:painter (with-style ((fill-color (make-color 0 0 0 0.5)))
+ (fill
+ (rectangle (vec2 0.0
+ (- window-height box-height))
+ box-width
+ box-height))))
+ (make <label>
+ #:name 'fps-label
+ #:rank 9
+ #:text "60.0"
+ #:font font
+ #:position (vec2 padding
+ (+ (- window-height box-height)
+ padding))))))
(attach-to fps-display canvas)))
(define-method (update-fps (fps-display <fps-display>) fps)
@@ -116,7 +118,7 @@
(define-class <window-config> ()
(width #:accessor window-width #:init-form 640 #:init-keyword #:width)
(height #:accessor window-height #:init-form 480 #:init-keyword #:height)
- (title #:accessor window-title #:init-form "Lisparuga"
+ (title #:accessor window-title #:init-form "Starling"
#:init-keyword #:title)
(fullscreen? #:accessor window-fullscreen? #:init-form #f
#:init-keyword #:fullscreen?))
@@ -210,9 +212,9 @@
(define (invert-y y)
;; SDL's origin is the top-left, but our origin is the bottom
;; left so we need to invert Y coordinates that SDL gives us.
- (match (sdl2:window-size (window kernel))
- ((_ height)
- (- height y))))
+ (call-with-values (lambda () (sdl2:window-size (window kernel)))
+ (lambda (width height)
+ (- height y))))
(define (process-event event)
(cond
((quit-event? event)