diff --git a/game.scm b/game.scm index 687e70c..74c5150 100644 --- a/game.scm +++ b/game.scm @@ -45,6 +45,7 @@ (ces entity-manager) (game-core) (game game-objects) + (game game-manager) (logging)) ;; Canvas settings @@ -57,11 +58,11 @@ (parameterize ((*logger* #f)) (write-log! "Creating entity manager") (define e-manager - (create-entity-manager)) + (create-entity-manager (init-game-entities))) (write-log! "Creating system manager") (define s-manager - (create-system-manager)) + (create-system-manager (init-game-systems))) (write-log! "Getting player image.") (define image:player (make-image "assets/images/ball.png")) diff --git a/modules/ces/system/html-canvas-renderer.scm b/modules/ces/system/html-canvas-renderer.scm index cebc826..b3cdb44 100644 --- a/modules/ces/system/html-canvas-renderer.scm +++ b/modules/ces/system/html-canvas-renderer.scm @@ -2,11 +2,12 @@ #:pure #:use-module (scheme base) #:use-module (scheme case-lambda) - #:use-module (ces system) - #:use-module (ces entity) #:use-module (ces component) + #:use-module (ces entity) + #:use-module (ces system) #:use-module (ces system sprite-renderer) #:use-module (ces system tilemap-renderer) + #:use-module (ces system-manager) #:use-module (dom canvas) #:use-module (game-core)) @@ -54,17 +55,16 @@ (run-systems! sys-manager dt) (run-systems-post-process! sys-manager)))) -(define (%system-processs-proc entity dt) +(define (%system-process-proc entity dt) (let ((sys-manager (get-system-manager))) - (begin - (%add-entity-to-renderer! entity) - %render-entities!))) + (%add-entity-to-renderer! entity) + (%run-rendering-subsystems! dt))) (define (create-html-canvas-renderer context) (let* ((rendering-subsystems (%make-rendering-systems context)) - (rendering-subsystem-manager (create-system-manager render-subsystems)) + (rendering-subsystem-manager (create-system-manager rendering-subsystems)) (renderer (%make-rendering-systems context))) (parameterize ((*system-manager-parameter* rendering-subsystem-manager)) - (create-system %wants-entity? + (create-system wants-entity? %system-process-proc #:entity-removed-hook %entity-removed-hook)))) diff --git a/modules/ces/system/sprite-renderer.scm b/modules/ces/system/sprite-renderer.scm index c7f7cfc..f16a96c 100644 --- a/modules/ces/system/sprite-renderer.scm +++ b/modules/ces/system/sprite-renderer.scm @@ -9,7 +9,7 @@ #:use-module (ces component position) #:use-module (ces entity) #:use-module (dom canvas) - #:export (create-rendering-system)) + #:export (create-sprite-rendering-system)) (define desired-components '('position 'sprite)) diff --git a/modules/game-core.scm b/modules/game-core.scm index 9288d8c..4c6a14a 100644 --- a/modules/game-core.scm +++ b/modules/game-core.scm @@ -18,8 +18,8 @@ get-entity-manager get-system-manager - %entity-manager-parameter - %system-manager-parameter)) + *entity-manager-parameter* + *system-manager-parameter*)) (define-record-type (make-game entity-manager system-manager previous-time)