2012-04-26 41 views
1

我想使用lispbuilder繪製曲面,但我無法將用戶指南/ API轉換爲工作示例。如何使用lispbuilder繪製曲面

這是我目前有:

(defun func (version) 
    (sdl:with-init() 
    (sdl:window 1023 768 :title-caption "Move a rectangle using the mouse") 
    (setf (sdl:frame-rate) 60) 
    (setf *map-surface* (sdl:load-image "...src/resources/map.jpg")) 
    (sdl:with-events() 
     (:quit-event() t) 
     (:key-down-event() 
       (sdl:push-quit-event)) 
     (:idle() 
     (sdl:draw-surface *map-surface*) 

     ;; Change the color of the box if the left mouse button is depressed 
     (when (sdl:mouse-left-p) 
      (setf *random-color* (sdl:color :r (random 255) :g (random 255) :b (random 255)))) 

      ;; Clear the display each game loop 
      (sdl:clear-display sdl:*black*) 

      ;; Draw the box having a center at the mouse x/y coordinates. 
      (sdl:draw-box (sdl:rectangle-from-midpoint-* (sdl:mouse-x) (sdl:mouse-y) 20 20) 
       :color *random-color*) 

      ;; Redraw the display 
      (sdl:update-display)))))) 

不過,這並不在所有的繪製表面。我已經檢查過表面是否加載成功。我也希望有一個關於該圖書館的教程/論文的建議,因爲實際的「用戶指南」不是真正的首發。

回答

0

其實,一切正常。但是,當您每次重畫屏幕((sdl:clear-display sdl:*black*))時,都無法看到圖片。嘗試評論此行...