;;; Lisp Game Jam 2018 ;;; Copyright © 2018 David Thompson ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as ;;; published by the Free Software Foundation, either version 3 of the ;;; License, or (at your option) any later version. ;;; ;;; 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 ;;; General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see ;;; . (define-module (engine shell) #:use-module (chickadee) #:use-module (chickadee math matrix) #:use-module (chickadee math rect) #:use-module (chickadee math vector) #:use-module (chickadee render) #:use-module (chickadee render font) #:use-module (chickadee render framebuffer) #:use-module (chickadee render sprite) #:use-module (chickadee scripting) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (engine assets) #:use-module (engine node) #:use-module (engine node-2d) #:use-module (oop goops) #:use-module (sdl2) #:use-module (srfi srfi-26) #:use-module (system repl command) #:use-module (system repl coop-server) #:use-module (system repl debug) #:use-module (system repl repl) #:export (make-shell current-scene switch-scene)) (define-asset shell-font (load-tile-font "assets/fonts/bubblemad_8x8.png" 8 8 " !\"©_%❤'()*+,-./0123456789:←<=>?@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")) (define %height 240) (define %width 320) (define-class () (debug? #:allocation #:virtual #:accessor debug? #:slot-ref (lambda (shell) (visible? (child-ref shell 'debug-overlay))) #:slot-set! (lambda (shell show?) (set! (visible? (child-ref shell 'debug-overlay)) show?))) (repl #:accessor repl #:init-form #f) (repl-debug #:accessor repl-debug #:init-form #f) (repl-debugging? #:accessor repl-debugging? #:init-form #f) (current-scene #:accessor current-scene #:init-form #f #:init-keyword #:current-scene) (reset #:getter reset-thunk #:init-form #f #:init-keyword #:reset) (framebuffer #:getter framebuffer #:init-form (make-framebuffer %width %height #:min-filter 'nearest #:mag-filter 'nearest)) (fb-region #:getter fb-region #:init-form (make-rect 0.0 0.0 (* 2 %width) (* 2 %height))) (projection #:getter projection #:init-form (orthographic-projection 0 %width %height 0 0 1)) (frame-start-time #:accessor frame-start-time) (avg-frame-time #:accessor avg-frame-time #:init-value 0.0) (eval-prompt #:accessor eval-prompt #:init-form (make #:name 'eval-prompt #:children (list (make