2012-04-26 49 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*))时,都无法看到图片。尝试评论此行...