[ascii] blitSurface basic

This commit is contained in:
2021-04-25 14:55:12 -06:00
parent 0e98e72245
commit 4f3f599909
13 changed files with 265 additions and 12 deletions

View File

@@ -4,19 +4,22 @@
letterWidth
letterHeight
_gameLogic
assetsBackend
_graphicsBackend]
// TODO the type annotation on this line feels like a bit much, but is necessary:
[:Graphics graphics (new Graphics width height)
:GameLogic gameLogic _gameLogic
:Assets assets (new Assets assetsBackend)
:GraphicsBackend graphicsBackend _graphicsBackend]
(graphicsBackend.initialize title width height letterWidth letterHeight))
(graphicsBackend.initialize title width height letterWidth letterHeight)
(gameLogic.initialize assets))
(defmethod update [:Float deltaSeconds]
(gameLogic.update deltaSeconds))
(gameLogic.update this deltaSeconds))
(defmethod draw []
(let [&mut changedGraphics false]
(gameLogic.draw (lambda [] (set changedGraphics true) graphics))
(gameLogic.draw (lambda [] (set changedGraphics true) graphics) assets)
(when changedGraphics (graphicsBackend.draw graphics))))