blob: 54664acd94f34c15ab826cd1930cacf672daf363 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
(use-modules (2d game)
(2d signals)
(2d sprite)
(2d vector2))
(define sprite
(delay (load-sprite "images/ghost.png"
#:position (vector2 320 240))))
(define quit-on-esc
(signal-lift (lambda (down?)
(when down?
(quit-game)))
(key-is-down 'escape)))
(define sprite-position
(signal-lift (lambda (pos)
(when (game-running?)
(set-sprite-position! (force sprite) pos)))
mouse-position))
(define (draw)
(draw-sprite (force sprite)))
;; TODO: make the quit condition a signal
(define demo
(make-game
#:title "Simple Demo"
#:draw draw))
(run-game demo)
|