summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2020-08-24 15:01:07 -0400
committerDavid Thompson <dthompson2@worcester.edu>2020-08-24 15:02:07 -0400
commit89563f5a727386da2175394813ee09601e7220e8 (patch)
tree94c4d2cd072e2fb6ca0d4773538f19c5619cf84d
parentcc3fc91b453f400241dc1db8e8ad6ef2433536f7 (diff)
Resize default viewport when window is resized.
Thanks to Peter Elliott <pelliott@ualberta.ca> for the original version of this patch.
-rw-r--r--chickadee.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/chickadee.scm b/chickadee.scm
index e7fb443..defa0a0 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -1,5 +1,6 @@
;;; Chickadee Game Toolkit
;;; Copyright © 2018 David Thompson <davet@gnu.org>
+;;; Copyright © 2020 Peter Elliott <pelliott@ualberta.ca>
;;;
;;; Chickadee is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published
@@ -306,7 +307,11 @@ border is disabled, otherwise it is enabled.")
(controller-move (lookup-controller
(controller-axis-event-which event))
(controller-axis-event-axis event)
- (/ (controller-axis-event-value event) 32768.0)))))
+ (/ (controller-axis-event-value event) 32768.0)))
+ ((window-resized-event? event)
+ (match (window-event-vector event)
+ ((width height)
+ (set! default-viewport (make-viewport 0 0 width height)))))))
;; Process all pending events.
(let loop ((event (poll-event)))
(when event