From: jsancho Date: Fri, 26 Aug 2011 07:04:56 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=61cbb86694ce19f0d5dd44ccf847c9fbd61b8f7e;p=gacela.git --- diff --git a/emacs/emacs.conf b/emacs/emacs.conf deleted file mode 100644 index 65645a5..0000000 --- a/emacs/emacs.conf +++ /dev/null @@ -1,21 +0,0 @@ -;;; Gacela configuration - -(defun launch-gacela () - (interactive) - (start-process "gacela" "gacela" "/home/jsancho/proyectos/gacela/trunk/src/gacela" "--dev")) - -(defun send-to-gacela () - (interactive) - (cond ((not (get-process "gacela")) - (launch-gacela))) - (cond ((use-region-p) - (process-send-region "gacela" (region-beginning) (region-end))) - (t - (process-send-region "gacela" (point-min-marker) (point-max-marker))))) - -(define-key global-map [(ctrl x) (ctrl g)] 'send-to-gacela) - -(define-key-after global-map [menu-bar tools gacela] (cons "Gacela" (make-sparse-keymap "hoot hoot")) 'games) -(define-key global-map [menu-bar tools gacela send] '("Send to Gacela" . send-to-gacela)) -(define-key global-map [menu-bar tools gacela launch] '("Launch Gacela" . launch-gacela)) - diff --git a/emacs/emacs_conf.lisp b/emacs/emacs_conf.lisp new file mode 100644 index 0000000..296c467 --- /dev/null +++ b/emacs/emacs_conf.lisp @@ -0,0 +1,22 @@ +;;; Gacela configuration + +(defun launch-gacela () + (interactive) + (start-process "gacela" "gacela" "/home/jsancho/proyectos/gacela/trunk/src/gacela" "--dev")) + +(defun send-to-gacela () + (interactive) + (cond ((not (get-process "gacela")) + (launch-gacela))) + (cond ((use-region-p) + (process-send-region "gacela" (region-beginning) (region-end))) + (t + (process-send-region "gacela" (point-min-marker) (point-max-marker)))) + (process-send-string "gacela" "\n")) + +(define-key global-map [(ctrl x) (ctrl g)] 'send-to-gacela) + +(define-key-after global-map [menu-bar tools gacela] (cons "Gacela" (make-sparse-keymap "hoot hoot")) 'games) +(define-key global-map [menu-bar tools gacela send] '("Send to Gacela" . send-to-gacela)) +(define-key global-map [menu-bar tools gacela launch] '("Launch Gacela" . launch-gacela)) + diff --git a/gacela_tetris.scm b/gacela_tetris.scm index 63e0fc7..d27a086 100644 --- a/gacela_tetris.scm +++ b/gacela_tetris.scm @@ -180,14 +180,13 @@ (translate 0 -30) (render-text (format #f "Lines: ~a" (get-lines)) font)))) -(define (run-gacela-tetris) - (let ((frame 0.0) (fps (make-timer)) (update (make-timer))) - (start-timer update) - (start-timer fps) - (run-game - (game) - (set! frame (+ frame 1)) - (cond ((> (get-time update) 1000) - (display (/ frame (/ (get-time fps) 1000.0))) - (newline) - (start-timer update)))))) +(let ((frame 0.0) (fps (make-timer)) (update (make-timer))) + (start-timer update) + (start-timer fps) + (run-game + (game) + (set! frame (+ frame 1)) + (cond ((> (get-time update) 1000) + (display (/ frame (/ (get-time fps) 1000.0))) + (newline) + (start-timer update))))) diff --git a/games/asteroids/asteroids.scm b/games/asteroids/asteroids.scm new file mode 100644 index 0000000..a1e23f6 --- /dev/null +++ b/games/asteroids/asteroids.scm @@ -0,0 +1,23 @@ +(set-game-properties! #:title "Gacela Asteroids") + +(define draw-asteroid + (let ((asteroid (load-texture "Asteroid.png"))) + (lambda (a) + (to-origin) + (translate (car a) (cadr a)) + (draw-texture asteroid)))) + +(define (move-asteroid a) + (let* ((x (car a)) (y (cadr a)) + (vx (caddr a)) (vy (cadddr a)) + (nx (+ x vx)) (ny (+ y vy))) + (cond ((> nx 320) (set! vx -1)) + ((< nx -320) (set! vx 1))) + (cond ((> ny 240) (set! vy -1)) + ((< ny -240) (set! vy 1))) + (list (+ x vx) (+ y vy) vx vy))) + +(let ((asteroids '((100 100 1 1) (-100 -100 -1 1)))) + (run-game + (set! asteroids (map move-asteroid asteroids)) + (for-each draw-asteroid asteroids)))