2016-04-23 241 views
0

任何人都可以在Mac OS X上開發常見的lisp遊戲?最近,我想在Mac OS X上建立一個lisp遊戲開發,但我陷入困境。在Mac OS X上安裝lispbuilder-sdl

Operating System version: 
    ProductName: Mac OS X 
    ProductVersion: 10.11.4 
    BuildVersion: 15E65 

sbcl version: 
    SBCL 1.3.3 

我發現GitHub的庫頁:https://github.com/lispbuilder/lispbuilder/wiki/DownloadInstallation,並按照OS X安裝的一部分。我嘗試安裝SDL 1.2和運行時二進制文件的運行時庫以及SDL 2.0的開發庫。它表現爲以下幾點:

當我運行它運行於Linux以及一些簡單的代碼,使用lispbuilder-SDL:

(defun draw-a-box-in-window() 
(sdl:with-init 
() 
(let ((width 500) 
     (height 500)) 
    (sdl:window width height) 
    (setf (sdl:frame-rate) 60) 
    (sdl:clear-display 
    (sdl:color 
    :r 127 
    :g 127 
    :b 127)) 
    (sdl:draw-box 
    (sdl:rectangle 
    :x (floor (/ width 3)) 
    :y (floor (/ height 3)) 
    :w (floor (/ height 3)) 
    :h (floor (/ height 3))) 
    :color (sdl:color 
      :r 200 
      :g 200 
      :b 200)) 
    (sdl:update-display) 
    (sdl:with-events 
    () 
    (:quit-event() t) 
    (:key-down-event() 
        (when (sdl:key-down-p :sdl-key-q) 
         (sdl:push-quit-event))))))) 
(draw-a-box-in-window) 

一些錯誤的事情發生了:

arithmetic error FLOATING-POINT-INEXACT signalled 
[Condition of type FLOATING-POINT-INEXACT] 

Restarts: 
0: [RETRY] Retry SLIME evaluation request. 
1: [*ABORT] Return to SLIME's top level. 
2: [ABORT] abort thread (#<THREAD "worker" RUNNING {1005D039E3}>) 

Backtrace: 
0: ("bogus stack frame") 
1: ("foreign function: -[NSPlaceholderNumber initWithDouble:]") 
2: ("foreign function: +[CALayer defaultValueForKey:]") 

任何人知道如何解決那?謝謝。

回答

0

你好@aries_liuxueyangm,我向你提出這個解決方案。

(ql:quickload 'lispbuilder-sdl) 

(asdf:operate 'asdf:load-op :lispbuilder-sdl) 
(asdf:operate 'asdf:load-op :cocoahelper) 

(defparameter *random-color* sdl:*white*) 

(defun draw-a-box-in-window() 
(sdl:with-init 
() 
(let ((width 500) 
     (height 500)) 
    (sdl:window width height) 
    (setf (sdl:frame-rate) 60) 
    (sdl:clear-display 
    (sdl:color 
    :r 127 
    :g 127 
    :b 127)) 
    (sdl:draw-box 
    (sdl:rectangle 
    :x (floor (/ width 3)) 
    :y (floor (/ height 3)) 
    :w (floor (/ height 3)) 
    :h (floor (/ height 3))) 
    :color (sdl:color 
      :r 200 
      :g 200 
      :b 200)) 
    (sdl:update-display) 
    (sdl:with-events 
    () 
    (:quit-event() t) 
    (:key-down-event() 
        (when (sdl:key-down-p :sdl-key-q) 
         (sdl:push-quit-event))))))) 


(defun main (argv &aux (argc (length argv))) 
    (draw-a-box-in-window) 
) 

(sb-int:with-float-traps-masked (:invalid :inexact :overflow) (main *posix-argv*)) 
+0

This works。非常感謝!雖然有時會發生奇怪的事情 – aries

+0

@aries如果它工作,你應該標記答案是正確的。這給了答案 - 呃他們當之無愧的業力 – Baggers

+0

@巴格斯感謝您的建議。我剛剛標記了它。 – aries