Closed liuxueyang closed 6 years ago
You appear to be using an inferior lisp and SBCL; I'm surprised you get this much. As far as I know, the only way to safely touch the GUI in OSX is by overriding the initial thread the lisp creates and doing all handling there.
With CCL, this can be done automatically. With SBCL, you need to do more work, manually creating a thread for slime/swank and using sdl2:make-this-thread-main
.
I switch to CCL, and run (sdl2-examples:basic-test)
, there is no window appears. ;-(
Similar issue here (SBCL bare or in SLIME in macosx). App skeleton is like that:
(defun sdl-main ()
(sdl2:with-init (:everything)
(sdl2:with-window (win :title "placeholder" :flags '(:opengl :shown))
(sdl2:with-gl-context (gl-context win)
(sdl2:gl-make-current win gl-context)
(sdl2:with-event-loop (:method :poll)
(:keyup (:keysym keysym)
(when (sdl2:scancode= (sdl2:scancode-value keysym) :scancode-escape)
(sdl2:push-event :quit)))
(:idle ()
; drawing goes here
(sdl2:delay 10))
(:quit () t))))))
(defun main ()
; making other thread main for sdl
(bt:make-thread (lambda ()
(sdl2:make-this-thread-main #'sdl-main))))
Window with properly rendered image shows up, but doesn't respond to input (ESC btn in this case). Also osx menu-bar for this window is stuck too.
P.S. Bare CCL behaves exactly the same.
Made a quick C prototype (main.c) to check if there's anything wrong with SDL itself. Nope. Input event handling works just fine.
Apparently, it's not really an osx window that shown when drawing with opengl. It pops up even when you don't specify neither :opengl
nor :shown
flags when creating a window. Bloody hell...
Is this still an issue @borodust ?
I don't know. Feel free to close.
I use SBCL in emacs SLIME. I press ESCAPE and it does not work. How to deal with this? Any help? Thanks. 😃