Fix html-canvas-renderer
This commit is contained in:
parent
27a2b64438
commit
47abe2da10
4 changed files with 14 additions and 13 deletions
5
game.scm
5
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"))
|
||||
|
|
|
@ -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))))
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue