X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=gacela.lisp;h=bc5dc4d9acbca0fa31ab6624e1e0814f55b83251;hb=6804b1518f1d390f23220626028989b4bc8e8c59;hp=b9b415a0b711121da8cb8dcea11faf2a75194669;hpb=57a2b49670c77a435b67d19fed2d4ea80e5d2a3f;p=gacela.git diff --git a/gacela.lisp b/gacela.lisp index b9b415a..bc5dc4d 100644 --- a/gacela.lisp +++ b/gacela.lisp @@ -204,30 +204,22 @@ (maphash (lambda (key res) (free-resource key)) resources-table))) -;;; Connection with the GUI +;;; Connection with Gacela Skin (let (socket) - (defun connect-to-gui () - (setq socket (si::socket 1984 :host "localhost"))) + (defun start-skin-client (port) + (when (null socket) (setq socket (si::socket port :host "localhost")))) - (defun eval-from-gui () - (cond ((and socket (listen socket)) (eval (read socket)))))) + (defun eval-from-skin () + (when (si::listen socket) + (secure-block socket (eval (read-from-string (read-line socket)))))) + (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))))))) +;;; GaCeLa Functions (let (time (time-per-frame (/ 1000.0 *frames-per-second*))) (defun set-frames-per-second (fps) (setq time-per-frame (/ 1000.0 fps))) @@ -246,14 +238,20 @@ (init-video-mode) (SDL_WM_SetCaption ,title "") (init-frame-time) + (eval-from-skin) + (refresh-running-mobs) (process-events) (do () ((quit?)) (glClear (+ GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT)) + (logic-mobs) + (render-mobs) (glLoadIdentity) ,@code (SDL_GL_SwapBuffers) (delay-frame) (init-frame-time) + (eval-from-skin) + (refresh-running-mobs) (process-events) (setq running nil)))) @@ -261,7 +259,7 @@ (free-all-resources) ; (quit-audio) (quit-video-mode) -; (quit-all-procs) + (quit-all-mobs) ; (clear-events) ; (quit-events) (quit-sdl))