X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela.lisp;h=bc5dc4d9acbca0fa31ab6624e1e0814f55b83251;hb=6804b1518f1d390f23220626028989b4bc8e8c59;hp=5d6eae05a4c8a96b5a288e8c6db34a99ae83eb13;hpb=ca6a66c5bbd26fb490b563189bd292a7c7f5f8a0;p=gacela.git diff --git a/gacela.lisp b/gacela.lisp index 5d6eae0..bc5dc4d 100644 --- a/gacela.lisp +++ b/gacela.lisp @@ -204,36 +204,22 @@ (maphash (lambda (key res) (free-resource key)) resources-table))) -;;; Gacela Server for development mode -(let (socket clients) - (defun server-running? () - (if socket t nil)) +;;; Connection with Gacela Skin +(let (socket) + (defun start-skin-client (port) + (when (null socket) (setq socket (si::socket port :host "localhost")))) - (defun start-server (port) - (setq socket (si::socket port :server #'eval-from-client))) + (defun eval-from-skin () + (when (si::listen socket) + (secure-block socket (eval (read-from-string (read-line socket)))))) - (defun check-server-connections () - (when (si::listen socket) (push (si:accept socket) clients))) - - (defun eval-from-clients () - (dolist (cli clients) (when (si::listen cli) (eval (read cli)))))) + (defun stop-skin-client () + (when socket + (si::close socket) + (setq socket nil)))) ;;; GaCeLa Functions -(let (commands) - (defun prog-command (command) - (setq commands (cons command commands))) - - (defun run-commands () - (cond (commands - (let (running) - (setq running commands) - (setq commands nil) - (labels ((run-com (comlst) - (cond (comlst (run-com (cdr comlst)) - (eval (read-from-string (concatenate 'string "(progn " (car comlst) ")"))))))) - (run-com running))))))) - (let (time (time-per-frame (/ 1000.0 *frames-per-second*))) (defun set-frames-per-second (fps) (setq time-per-frame (/ 1000.0 fps))) @@ -252,6 +238,7 @@ (init-video-mode) (SDL_WM_SetCaption ,title "") (init-frame-time) + (eval-from-skin) (refresh-running-mobs) (process-events) (do () ((quit?)) @@ -263,6 +250,7 @@ (SDL_GL_SwapBuffers) (delay-frame) (init-frame-time) + (eval-from-skin) (refresh-running-mobs) (process-events) (setq running nil))))