Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gamekit:stop does not work in a event handler #30

Closed
lthms opened this issue Jun 16, 2018 · 5 comments
Closed

gamekit:stop does not work in a event handler #30

lthms opened this issue Jun 16, 2018 · 5 comments

Comments

@lthms
Copy link

lthms commented Jun 16, 2018

Hi.

I am considering playing around with trivial-gamekit. Fair warning (and apologies in advance): I am very novice in common lisp.

I have been able to have a minimum working example (after installing quilcklisp).

I wanted to be able to quit the game from within the game, when for instance I press the left button of my mouse. Here is my code:

(cl:in-package :lysk)

(gamekit:defgame example () ())

(defmethod gamekit:post-initialize ((app example))
  (gamekit:bind-button :mouse-left :released
                       (lambda () (gamekit:stop))))

(defun run ()
  (gamekit:start 'example))

Unfortunately, it does not work, and even worth I cannot use gamekit:stop from the repl after a pressed left button.

Could you help me a bit here? I have no idea how to do this.

Thanks by advance, for your help and for your work.

@borodust
Copy link
Owner

Hi! Thank you for the report. At the moment #'stop works synchronously which means when called from the event callback it actually blocks the engine. Let me fix that :)

@borodust
Copy link
Owner

Fixed in bodge dist.

(ql:update-all-dists)

@borodust
Copy link
Owner

Please, let me know if it works fine for you after updating the dist.

@lthms
Copy link
Author

lthms commented Jun 16, 2018

Looks like it is working perfectly! Thanks a lot for your awesome reactivity. I will try to dive more into this, to see if I can implement a game client for my 2D online game using this project.

@borodust
Copy link
Owner

That would be awesome! Feel free to fire any issues or shoot any questions here or on #lispgames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants