From: jsancho Date: Fri, 18 Sep 2009 15:45:18 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=5e3843acaf7628122c750406e48e83ac6fdb6312;p=gacela.git --- diff --git a/gacela.lisp b/gacela.lisp index dcbddde..9663a82 100644 --- a/gacela.lisp +++ b/gacela.lisp @@ -127,11 +127,11 @@ t)) (let ((current-color '(1 1 1 1))) - (defun get-color () + (defun get-current-color () current-color) - (defun set-color (red green blue (&optional (alpha 1))) - (setq current-color color) + (defun set-current-color (red green blue &optional (alpha 1)) + (setq current-color (list red green blue alpha)) (glColor4f red green blue alpha))) (defun copy-surface (source) @@ -312,18 +312,6 @@ ;;; GaCeLa Functions -;(defun game-loop (code) -; (process-events) -; (cond ((quit?) nil) -; (t -; (glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT)) -; (glLoadIdentity) -; (translate 0 0 *zoom*) -; (funcall code) -; (SDL_GL_SwapBuffers) -; (SDL_Delay (- *gacela-freq* (rem (SDL_GetTicks) *gacela-freq*))) -; (game-loop code)))) - (let (commands) (defun prog-command (command) (setq commands (cons command commands))) @@ -367,19 +355,6 @@ (process-events) (setq running nil)))) -;(defun run-game () -; (init-video-mode) -; (SDL_WM_SetCaption *title-screen* "") -; (refresh-active-procs) -; (enjoy!) -; (do () ((quit?)) -; (process-events) -; (logic-procs) -; (motion-procs) -; (refresh-active-procs) -; (refresh-screen) -; (SDL_Delay (- *gacela-freq* (rem (SDL_GetTicks) *gacela-freq*))))) - (defun quit-game () ; (free-all-resources) ; (quit-audio) diff --git a/gacela_draw.lisp b/gacela_draw.lisp index 88e7738..7c5a2d9 100644 --- a/gacela_draw.lisp +++ b/gacela_draw.lisp @@ -28,6 +28,12 @@ (defun 3d-mode? () (eq mode '3d))) +(defmacro with-color (color &body code) + `(progn + (apply #'set-current-color ,color) + ,@code + (apply #'set-current-color ,(get-current-color)))) + (defun draw (&rest vertexes) (begin-draw (length vertexes)) (draw-vertexes vertexes)