我想使用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))))))但它根本不会绘制曲面。我已经检查过表面是否加载成功。我也希望能推荐一篇关于这个库的教程/论文,因为真正的“用户指南”并不是真正针对初学者的。
发布于 2012-04-26 23:44:36
实际上,一切都正常。但是,当您每次重新绘制屏幕((sdl:clear-display sdl:*black*))时,您看不到图片。尝试注释掉这行...
https://stackoverflow.com/questions/10334309
复制相似问题