我想使用lispbuilder绘制曲面,但我无法将用户指南/ api转换为实际示例。
这就是我目前所拥有的:
(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 :(得分:0)
实际上,一切正常。但是当你每次重新绘制屏幕时((sdl:clear-display sdl:*black*)
),你都无法看到图片。尝试评论这一行......