From: jsancho Date: Sat, 7 Nov 2009 10:04:18 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=377bf34ac61998549b24e339e3a3eea80734b6e3;p=gacela.git --- diff --git a/gacela.lisp b/gacela.lisp index 5d6eae0..fb8438b 100644 --- a/gacela.lisp +++ b/gacela.lisp @@ -206,14 +206,11 @@ ;;; Gacela Server for development mode (let (socket clients) - (defun server-running? () - (if socket t nil)) - (defun start-server (port) - (setq socket (si::socket port :server #'eval-from-client))) + (when (null socket) (setq socket (si::socket port :server #'eval-from-clients)))) (defun check-server-connections () - (when (si::listen socket) (push (si:accept socket) clients))) + (when (and socket (si::listen socket)) (push (si:accept socket) clients))) (defun eval-from-clients () (dolist (cli clients) (when (si::listen cli) (eval (read cli)))))) @@ -252,6 +249,8 @@ (init-video-mode) (SDL_WM_SetCaption ,title "") (init-frame-time) + (check-server-connections) + (eval-from-clients) (refresh-running-mobs) (process-events) (do () ((quit?)) @@ -263,6 +262,8 @@ (SDL_GL_SwapBuffers) (delay-frame) (init-frame-time) + (check-server-connections) + (eval-from-clients) (refresh-running-mobs) (process-events) (setq running nil)))) diff --git a/game.lisp b/game.lisp index c0cbbed..cfb1f55 100755 --- a/game.lisp +++ b/game.lisp @@ -1,21 +1,33 @@ -(show-mob (make-mob :x 0 :y 0 :image (filled-rect 5 420) :tags '(wall))) -(show-mob (make-mob :x 635 :y 0 :image (filled-rect 5 420) :tags '(wall))) -(show-mob (make-mob :x 0 :y 0 :image (filled-rect 640 5) :tags '(wall))) +;(show-mob (make-mob :x 0 :y 0 :image (filled-rect 5 420) :tags '(wall))) +;(show-mob (make-mob :x 635 :y 0 :image (filled-rect 5 420) :tags '(wall))) +;(show-mob (make-mob :x 0 :y 0 :image (filled-rect 640 5) :tags '(wall))) -(show-mob (make-mob :x 280 :y 420 :image (filled-rect 80 20) :tags '(wall) - :logic (movement-with-cursors :xvel 200 :yvel 0))) +;(show-mob (make-mob :x 280 :y 420 :image (filled-rect 80 20) :tags '(wall) +; :logic (movement-with-cursors :xvel 200 :yvel 0))) -(let ((xvel 100) (yvel -100)) - (show-mob (make-mob :x 300 :y 200 :image (filled-circle 7) - :logic (progn - (cond ((> y 480) (setq x 300 y 200 xvel 100 yvel -100)) - (t (let ((c (collision '(wall)))) - (cond ((null c) nil) - ((= c (neg (/ pi 2))) (setq yvel (neg (- yvel 10)))) - ((= c (/ pi 2)) (setq yvel (neg (+ yvel 10)))) - ((= c 0) (setq xvel (neg (+ xvel 10)))) - ((= c pi) (setq xvel (neg (- xvel 10)))))))) - (movement :xvel xvel :yvel yvel))))) +;(let ((xvel 100) (yvel -100)) +; (show-mob (make-mob :x 300 :y 200 :image (filled-circle 7) +; :logic (progn +; (cond ((> y 480) (setq x 300 y 200 xvel 100 yvel -100)) +; (t (let ((c (collision '(wall)))) +; (cond ((null c) nil) +; ((= c (neg (/ pi 2))) (setq yvel (neg (- yvel 10)))) +; ((= c (/ pi 2)) (setq yvel (neg (+ yvel 10)))) +; ((= c 0) (setq xvel (neg (+ xvel 10)))) +; ((= c pi) (setq xvel (neg (- xvel 10)))))))) +; (movement :xvel xvel :yvel yvel))))) -(run-game) -(quit-game) +;(run-game) +;(quit-game) + +(let ((r 0)) + (gacela::makemob cuadrado + :render (lambda () + (gacela::rotate 0 0 r) + (incf r 5) + (gacela::draw-cube :size 40)))) + +;(cuadrado :on) +(gacela::start-server 1984) + +(gacela::run-game "Prueba Mobs")