;;; Starling Game Engine ;;; Copyright © 2018, 2020 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 Starling. If not, see . ;;; Commentary: ;; ;; This is the core of the game engine, the root node, that is ;; responsible for starting up the game loop and passing along render, ;; update, and input events to the other parts of the game. ;; ;;; Code: (define-module (starling kernel) #:use-module (chickadee audio) #:use-module (chickadee game-loop) #:use-module (chickadee graphics color) #:use-module (chickadee graphics engine) #:use-module (chickadee graphics font) #:use-module (chickadee graphics path) #:use-module (chickadee graphics viewport) #:use-module (chickadee math rect) #:use-module (chickadee math vector) #:use-module (chickadee scripting) #:use-module (gl) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (oop goops) #:use-module ((sdl2) #:select (sdl-init)) #:use-module (sdl2 events) #:use-module (sdl2 input game-controller) #:use-module (sdl2 input joystick) #:use-module (sdl2 input text) #:use-module (starling asset) #:use-module (starling config) #:use-module (starling node) #:use-module (starling node-2d) #:use-module (starling repl) #:use-module (starling repl-server) #:use-module (starling minibuffer) #:use-module (starling scene) #:use-module (starling system) #:use-module ((sdl2 video) #:prefix sdl2:) #:use-module (system repl command) #:export ( window-width window-height window-title window-fullscreen? window-config update-hz window gl-context avg-frame-time current-kernel boot-kernel fps reboot-current-scene) #:re-export (abort-game)) ;;; ;;; FPS Display ;;; (define-class ()) (define-method (on-boot (fps-display )) (let* ((display (make #:name 'display)) (font (default-font)) (padding 4.0) (box-width (+ (font-line-width font "60.0") (* padding 2.0))) (box-height (+ (font-line-height font) (* padding 2.0)))) (call-with-values current-window-size (lambda (window-width window-height) (attach-to display (make #: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