1

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))))))

しかし、それは表面をまったく描画しません。サーフェスが正常に読み込まれたかどうかは既に確認しました。実際の「ユーザーガイド」は初心者向けではないため、そのライブラリをカバーするチュートリアル/ペーパーへの推奨もいただければ幸いです。

4

1 に答える 1

0

実際、すべてが機能します。しかし、毎回画面を再描画すると ( (sdl:clear-display sdl:*black*))、画像が表示されなくなります。この行をコメントアウトしてみてください...

于 2012-04-26T15:44:36.107 に答える