22 lines
752 B
Plaintext
22 lines
752 B
Plaintext
(defnew [title
|
|
width
|
|
height
|
|
letterWidth
|
|
letterHeight
|
|
_gameLogic
|
|
_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
|
|
:GraphicsBackend graphicsBackend _graphicsBackend]
|
|
|
|
(graphicsBackend.initialize title width height letterWidth letterHeight))
|
|
|
|
(defmethod update [:Float deltaSeconds]
|
|
(gameLogic.update deltaSeconds))
|
|
|
|
(defmethod draw []
|
|
(let [&mut changedGraphics false]
|
|
(gameLogic.draw (lambda [] (set changedGraphics true) graphics))
|
|
(when changedGraphics (graphicsBackend.draw graphics)))) |