Fix html-canvas-renderer

This commit is contained in:
TakeV 2024-05-25 04:15:45 -04:00
parent 27a2b64438
commit 47abe2da10
Signed by: TakeV
GPG key ID: A64F41345C7400AF
4 changed files with 14 additions and 13 deletions

View file

@ -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"))

View file

@ -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!)))
(%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))))

View file

@ -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))

View file

@ -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 <game>
(make-game entity-manager system-manager previous-time)