From: jsancho Date: Mon, 29 Aug 2011 17:03:04 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?p=gacela.git;a=commitdiff_plain;h=f52afe4d66f4708213e5823ce4d383e82bedce44 --- diff --git a/games/asteroids/asteroids.scm b/games/asteroids/asteroids.scm index bda8fc0..3a355a6 100644 --- a/games/asteroids/asteroids.scm +++ b/games/asteroids/asteroids.scm @@ -54,6 +54,10 @@ (set! moving #f))) `((x . ,x) (y . ,y) (angle . ,angle) (moving . ,moving)))) +(define (ship-shot s) + (cond ((key-released? 'space) + #f))) + (define (make-asteroids n) (define (xy n r) (let ((n2 (- (random (* n 2)) n))) @@ -71,6 +75,8 @@ (run-game (set! asteroids (map move-asteroid asteroids)) (set! ship (move-ship ship)) - (set! shots (ship-shots + (let ((shot (ship-shot ship))) + (cond (shot + (set! shots (cons shot shots))))) (for-each draw-asteroid asteroids) (draw-ship ship))) diff --git a/src/gacela_draw.scm b/src/gacela_draw.scm index 5290dc4..9500429 100644 --- a/src/gacela_draw.scm +++ b/src/gacela_draw.scm @@ -39,7 +39,8 @@ (glEnd)) (define (begin-draw number-of-points) - (cond ((= number-of-points 3) (glBegin GL_TRIANGLES)) + (cond ((= number-of-points 2) (glBegin GL_LINES)) + ((= number-of-points 3) (glBegin GL_TRIANGLES)) ((= number-of-points 4) (glBegin GL_QUADS)))) (define (draw-vertexes vertexes) @@ -112,6 +113,13 @@ (height (texture-h texture))) (draw-rectangle (* zoom width) (* zoom height) #:texture texture))))) +(define* (draw-line length #:optional color) + (let ((l + (cond (color + (with-color color (draw v1 v2))) + (else + (draw v1 v2)))) + (define* (draw-quad v1 v2 v3 v4 #:key texture color) (cond (texture (progn-textures